Write convertToTree to turn a flat array of folders and files into a nested tree for a recursive sidebar component.
Unlock detailed company stats for this questionUpgrade
Example input: [{id: 4, parentId: 2, name: 'Resume.pdf'}, {id: 1, parentId: null, name: 'Root'}, {id: 2, parentId: 1, name: 'Documents'}, {id: 3, parentId: null, name: 'Config'}].
Community answers
No answers contributed by the community yet.
Related questions
Write a flatten function to convert a nested object into an array.Related courses

Course

