@jswork/next-tree-walk
Version:
Tree data walker.
48 lines (37 loc) • 1.31 kB
Markdown
# next-tree-walk
> Tree data walker.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```bash
npm install -S @jswork/next-tree-walk
```
## usage
```js
import '@jswork/next-tree-walk';
class MyComponent extends React.Component{
get childView(){
const { items, itemsKey, template } = this.props;
return nx.treeWalk(items, { template, itemsKey: 'children' });
}
render(){
return (
<div>
{this.childView}
</div>
)
}
}
```
## license
Code released under [the MIT license](https://github.com/afeiship/next-tree-walk/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@jswork/next-tree-walk
[version-url]: https://npmjs.org/package/@jswork/next-tree-walk
[license-image]: https://img.shields.io/npm/l/@jswork/next-tree-walk
[license-url]: https://github.com/afeiship/next-tree-walk/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-tree-walk
[size-url]: https://github.com/afeiship/next-tree-walk/blob/master/dist/next-tree-walk.min.js
[download-image]: https://img.shields.io/npm/dm/@jswork/next-tree-walk
[download-url]: https://www.npmjs.com/package/@jswork/next-tree-walk