E-Commerce Product Page with Add to Cart Function using ReactJs

Solution retrospective
I had some issues with state management implementing the add to cart function across different components which i solved with the use of props .I am not sure if its the best practice for managing state.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @DavidMorgade
Hello and congrats on finishing the challenge!
To answer your question, passing state as props is not that bad when the state is for a direct related component, but sometimes you have to pass the state to lower/higher level components, for this case is better to use the React Context or Redux, for larger applications Redux may be a better option (where the state changes constantly), for smalls apps and state that don't change that much often, is better to use the useContext hook, checkout how react Context works, is really worth it!
Hope my feedback helps you!
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord