I have this simple Counter using React / Redux:
https://stackblitz.com/edit/react-kkcgza?file=App.js
It is said that Redux can let any component get a value? (meaning Redux can let us decide where the destinations are for our state).
Can someone tell me how to let the App component get the count value and show it? (besides letting the Counter show it) -- can you edit online and fork a copy if you can?
Top comments (1)
The thing to bear in mind with React is the data flow is top down -
Apppasses data downwards toCountervia props. So ifAppis interested in the data then either:It could contain the logic (i.e. it becomes the 'container') - see medium.com/@dan_abramov/smart-and-...
You could connect the App component to the Redux store (using the
connecthoc)