Possible Gotcha
Explore the potential pitfalls of assigning state directly from the Redux store in React applications. Learn why using Redux as the single source of truth for state management is crucial, and how to properly feed Redux state as props to components while avoiding React's local setState method.
We'll cover the following...
We'll cover the following...
In the just concluded Hello World example, a possible solution you may have come up with for grabbing the state from the STORE may look like this:
What do you think? Will this work? Just as a reminder, the following two ways are correct ways to initialise a React component’s state.
(a)
(b)
So, back to answering the question, yes, the solution will work just fine.
store.getState() ...