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