Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

React.js + Typescript Comments Section

Better5afe 850

@better5afe

Desktop design screenshot for the Interactive comments section coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi All,

Hope you're well.

I've just completed another project in React.js and TypeScript.

This one was fun, at the beginning I had no idea how to create a comment and nested replies list, but I think I somehow managed to do it in a nice way:

  • you can add comments and replies, edit and delete them
  • for modal, I used a portal to make it appear above the main app content
  • Ihave also added an extra reply to show that only 3 levels of replies are allowed and if you delete a parent comment or reply, the child ones also get deleted
  • state in the app is managed via React Context
  • functions for fetching, adding, deleting and editing the comments are exported from a separate file that imitates a dummy API

Hope you like it and as always, I'll be grateful for any suggestions what I can improve.

Thanks!

Community feedback

Please log in to post a comment

Log in with GitHub
Discord logo

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