Submitted almost 3 years ago
Interactive Comments Section with React, React Context and BEM
@kreyson999
Design comparison
SolutionDesign
Solution retrospective
What should i do to make this code "cleaner"? Is React Context good solution for this app? What should i do to save this data to localStorage immediately, because i'm saving this data after setState and we know that setState is asynchronous so saved data isn't always current?
Community feedback
- @adram3l3chPosted almost 3 years ago
Hey yoy did great 👍. You can solve the local storage problem using useEffect.
useEffect(()=> localStorage.setItem ("comments",JSON.stringify(state)) ,state)
Marked as helpful1
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