Answer the question
In order to leave comments, you need to log in
How to pass data to functional components?
Good afternoon. I switch from class components to functional ones, using hooks. Now the question arose, how to actually pass data to the components?
After all, if I pass data directly to the component, then it will no longer be a presentational component, but too smart, because the presentational component implies reuse and predictability, container components in the form of classes come to the rescue, and the connection function with mapStateToProps and mapDispatchToProps (and in further compose for HOCs). At the moment, my App component is wrapped in a provider that provides a store. So how can I do it better? I just don't want to create containers.
If I pass all the data from one component to another using props, then soon everything will turn into a mess
Answer the question
In order to leave comments, you need to log in
I use useSelector as an alternative to mstp. But I can't implement mdtp yet.
So if everything is wrapped in a provider, can useContext be used? Or am I missing something
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question