Design comparison
Solution retrospective
Hello! This is my firs app build with RACT and i had a problem with showing orange icon above the basket. When I add some stuff to basket It shows immidiately(i use the state to trigger rerendering), but when I delete product from the basket(component that delete the basket is too remote to use the same state as before). I need to click somewhere else to make the component refresh. Is it possible to make it show with out useing REDUX?
Community feedback
- @Vijaya03Posted over 2 years ago
Hello amichno , Congrats on the first react project You could try using functionals components and use react hooks . There is a hook named useContext . It will help you update state inside nested components easily.
All the best
Marked as helpful0@amichnoPosted over 2 years ago@Vijaya03 thank you for you tip, that was what i have been looking for
1 - @fazzaamiarsoPosted over 2 years ago
Hello amichno! Congratulation on your first React project!
You don't need to use Redux here. You can use Context API to share between distant component. But, I strongly recommend you to try switching to React Hooks. Here is the new React re-written docs [https://beta.reactjs.org/] (https://beta.reactjs.org/).
One more thing, here is a great resource to get started with React. https://kentcdodds.com/blog/how-to-react. You will be on the right track following the advice in the blog post.
Keep on Coding!!
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin 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