Skip to content

Instantly share code, notes, and snippets.

@Vitaleks-project
Created December 30, 2021 09:50
Show Gist options
  • Save Vitaleks-project/7a8905c84b64dc74b74c967ab8aaa461 to your computer and use it in GitHub Desktop.
Save Vitaleks-project/7a8905c84b64dc74b74c967ab8aaa461 to your computer and use it in GitHub Desktop.
// Build folders tree.
// Example how should result looks like
// folderTree = {
// folders: [{
// folders: [{
// id,
// name,
// folders: []
// }]
// }]
// };
const folders = [
{ id: 1, parent: null, name: 'Main videos' },
{ id: 2, parent: 1, name: 'Kitchen videos' },
{ id: 3, parent: 1, name: 'Garden videos' },
{ id: 4, parent: 3, name: 'Garden videos1' },
{ id: 5, parent: 3, name: 'Garden videos2' },
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment