Prompt 1
Build a file explorer from nested data in React
Practice version modelled on a reported round: Public report: Taro frontend internship loop, July 2023
What this measures
Clarify first
Ask whether folders start open or closed, whether several folders can be open at once, and whether clicking a file must do anything. Confirm the data shape: is every folder given a children array, can a folder be empty, and do items carry ids or must keys come from their paths?
Strong answer should cover
Render one recursive node component that takes an item and its depth; a folder renders its children only when open, a file renders a row with its icon. Keep open state as a set of folder ids at the top, or inside each folder component if nothing else needs it, and say why you chose one. Key rows by id or path, indent by depth, and make each folder row a button with aria-expanded so the tree works from the keyboard. Test an empty folder, a deep path, two folders with the same name in different places, and toggling a folder twice.
Common miss: