Answer the question
In order to leave comments, you need to log in
Is it ok to put setState in another component's prop?
I have a question, please tell me, for example, in the app component there is some kind of State, for example,
is it normal to pass setTest to another component through props? const [test, setTest] = useState('');
Answer the question
In order to leave comments, you need to log in
Quite. For example, for many components, not an Event, but a new value is passed to the onChange callback, and it is convenient to pass setValue there. The main thing is that that other component does not call it after unmounting the hook-owning component
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question