Answer the question
In order to leave comments, you need to log in
Is it worth taking data from data parameters?
Tell me, as far as I understand, it is highly undesirable to pass event handlers to components that will be created anew each time, that is, onClick={() => action()}.
It is correct to move the handler to a variable and then it will not be created anew each time.
Then the question arises, how can you pass data to the parent component? onClick={() => props.handler(data)} can't be done anymore. Somewhere I saw an option to leave the data in the data attributes, and in the handler to take them from there.
To what extent is this practice necessary or are these already unnecessary troubles, and this problem is far-fetched?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question