I recently started using the Context React Api with useContext Hook. I have observed that when we have a state variable i.e. const someState = useState(state, setState), some developers pass setSate directly in the provider values and then calling it in children components. Is that a good practice?
When you do not use context you have to create a handler to "access" setState in a child component. I am still using handler functions and pass them into the provider values, to import them from context in children.
Is passing setState in context a good pracice? I still have some doubts since normally you cannot pass setState directly into a component. Is there any difference in performance or any other drawbacks I should be considering?
Thank you.