Menu

πŸš€ New React Challenge: Nested Comments
πŸ“°

πŸš€ New React Challenge: Nested Comments

DEV Community: typescriptΒ·ReactChallengesΒ·5 days ago
#fxU1XNEu
#devtotypescript#devto#dev#comment#replies
Reading 0:00
15s threshold

Flattening a comment thread into a single array works until you need to reply to a reply. Then you're faking depth with parent ids, and every edit or delete means rebuilding the whole list. A recursive tree keeps the shape of the conversation and lets you update just the branch that changed.

🧩 Overview

Build a threaded comments UI: render a recursive thread, then reply, edit, collapse, and delete nodes while every update returns a new tree instead of mutating the seed.

πŸ‘‰ https://www.reactchallenges.com/challenges/nested-comments

βœ… Requirements

Render the full thread from initialComments , with replies nested inside their parent.

Each comment shows its author and text, and exposes reply, edit, and delete controls.

Comments with replies get a collapse control with aria-expanded that hides or shows only their replies.

Replying opens a form, appends a trimmed reply authored by "You", and closes it.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.