react-tree-walker
react-tree-walker copied to clipboard
feature request: provide current element depth to visitor function
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
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