Put in order · Vibe coding with Claude Code course · Module 5: Reddit clone

Sorting: The order of a thread on screen

The flat list has, in order: Morgan (parentId null), Redbeard (replies to Morgan), Polly (replies to Redbeard), Jack (parentId null). Arrange the comments as CommentThread shows them from the top of the screen:

Items to put in order

  • u/Jack (depth 0)
  • u/Morgan (depth 0)
  • u/Redbeard (depth 1)
  • u/Polly (depth 2)

You can check the correct answer by solving this task in the CodeWorlds game.