Create Nested Comments in React — Reddit-Style Threaded Comment System with Likes Dislikes and Delete
Build a nested comments system like Reddit or HackerNews in React. Features: add a top-level comment, reply to any comment at any depth (infinitely nested), like a comment (increment like count), dislike a comment (increment dislike count), and delete a comment (removes it and all its replies). Use a normalized state structure — store all comments keyed by id — for efficient lookups and updates. Use Context API for state management (container-presentation pattern): the context holds the comments state and exposes add/like/dislike/delete methods. Render comments recursively. Must be solved within 1–1.5 hours. This was asked in Adobe's and Swiggy's SDE2 frontend interviews.