mobxjs / mobx-state-tree

Full-featured reactive state management without the boilerplate
https://mobx-state-tree.js.org/
MIT License
6.94k stars 640 forks source link

how to flattern a tree data with views #2000

Closed dodoto closed 1 year ago

dodoto commented 1 year ago

Question

I have a tree object like this:

[ 
  {
    id: 1, 
    isOpen: true,
    children: [{id: 1-1, isOpen: false, children: []}]
  }
]

after flattern get this:

[{id: 1, isOpen: true, children: []}, {id: 1-1, isOpen: false, children: []}]

what should I do can get this with views.