Interactive comments section using React

Solution retrospective
It took me muuuuuch longer than I expected since it's my first React project. The main problem with this project is that I needed to use useState of all messages in main App component and then pass it to next components, but instead I tried to update the exact message inside of it. I understood it when I asked myself: "How would I send the whole pack of messages to the server if I had to? Did all my messages array get updated?". I figured it out by just placing a mock button at the end of the page with console logging the last message of my messages array from main App component. The result showed me that the main array of messages didn't get updated and because of that the function getId() in App component failed to assign a unique ID for new replies. Unfortunately I realized it too late and I got tired of the project so I leave it for a better days. P.S. Probably Redux could help me avoid this mistake. I'll check it in next projects!
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Daniil's solution.
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