react-tree-walker icon indicating copy to clipboard operation
react-tree-walker copied to clipboard

feature request: provide current element depth to visitor function

Open alidcast opened this issue 7 years ago • 1 comments

Hey @ctrlplusb, thanks for extracting this utility out for other libraries!

would you be inclined to pass the current element depth/index in the tree as the last argument to the visitor function? It's useful if you want to limit how far down you want to walk the component tree, e.g. if implementing a custom getInitialProps

Thanks

alidcast avatar Jun 21 '18 19:06 alidcast

upon opening this I realized there might be a way I can implement the feature I have in mind without knowing the element's depth

but I'll keep this issue open in case you're interested in it

alidcast avatar Jun 21 '18 19:06 alidcast