For further actions, you may consider blocking this person and/or reporting abuse
The Next Generation Developer Platform
Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.
Read next
![shaikhkamran profile image](https://media2.dev.to/dynamic/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F899562%2F516a5de8-f186-45a9-86cd-b2f3515bfd7d.jpeg)
How I Build about 60% of My App's Codebase in a day.
kamran -
![tqbit profile image](https://media2.dev.to/dynamic/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F544741%2Fb5a0124d-90f4-4d11-bf48-119ccdb16344.png)
Master Efficient Window Scroll Event Handling in JavaScript: Best Practices and Tips
tq-bit -
![manoj_004d profile image](https://media2.dev.to/dynamic/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F138802%2F8bbb787a-3922-4853-9bf8-0dcf40653dae.jpg)
Display Chart in Express.js App using CanvasJS
Manoj Mohan -
![ayoola_damilare_212d5bde0 profile image](https://media2.dev.to/dynamic/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2450825%2Faccaea84-b791-4926-8bf7-9193ab12bb88.jpg)
My React Journey: Day 9
Ayoola Damilare -
Top comments (2)
Because what you have here is a doubly linked tree, you have a choice how you want to populate the tree. I think it would be easier attaching children to their parents.
What I would do is:
children
(it's because the name childrenID suggest, that it has something to do with ID, not the children themselves)parentID
from the lookup map and push it at the end of thechildren
arrayparentID: null
. You could use.filter
for this.For better efficiency, you could bundle points 2, 3 and 4 into one.
Good luck!
I FOUND A SOLUTION - jsfiddle.net/cw9rq7ht/6/