FAQs on the exercise Connect the Redux Store to a UI
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
In this lesson, index.js subscribes to the store and then passes the state and dispatch functions down as props to App.js.
Given the idea of redux sounds like centralizing / simplifying state management, could App.js directly subscribe to the store itself? I guess the issue is that the subscribe function needs to trigger “render”, which is contained in index.js?
could App.js directly subscribe to the store itself?
Yes.
I guess the issue is that the subscribe function needs to trigger “render”, which is contained in index.js?
No. There’s nothing to prevent all this going in one file.
The answer to the issue of your question is hinted at by who developed all this - Facebook. Their code repository is said to have many millions of lines of code in many thousands of modules. In that context, functional-modular React with Redux make perfect sense (type “advantages of using React and Redux” into M$ Copilot or ChatGPT for a list).
Learning a programming model like this that’s suited to and developed for a huge environment using necessarily bite-sized chunks is always going to be challenging.
Hello guys, I was wondering, isn’t all of this redux usage inefficient since we are re-rendering the whole App component? Wasn’t the point of react to only re-render the changes in the virtual DOM?