react-vt icon indicating copy to clipboard operation
react-vt copied to clipboard

React Router Support?

Open towfiqi opened this issue 8 years ago • 4 comments

Any plan on adding React Router compatibility any time soon?

Thanks

towfiqi avatar Aug 26 '17 02:08 towfiqi

For real. I was stoked about giving this tool a shot, but my team uses RR (like everybody else in the world) so it is a no go.

I consider this a blocker. Please help me get unblocked!

colshacol avatar Aug 26 '17 19:08 colshacol

Same here! How could I help?

vhfmag avatar Aug 28 '17 19:08 vhfmag

👍 Would love to play around with it as well, but I almost always use RR

morfarpeter avatar Aug 28 '17 21:08 morfarpeter

Thanks for all the interest in RR - we've tried exploring adding this compatibility but we've been having a hard time figuring out how React Router affects React's internal instance/virtual DOM.

The way ReactVT currently gets state, props, and component information is by traversing through _ReactInternalInstance (you can see this for yourself if you console log 'this' from your top-level component class) from the top-level component all the way down to the children components. RR breaks this structure as soon as it's introduced into the application.

From what we can tell, RR acts as a wrapper component for each stateful React component, which destroys the references in ReactInternalInstance. Every component becomes a Route/Connect component that seem to lose reference to its parent component. There should be a way to access the information that RR has obfuscated, but we've yet to find a way where the convention that we had with pure ReactInternalInstance is preserved.

Our fear is that the we might need an individual point of entry for every component that the user wants to test so that we can "stitch" the virtual DOM structure together. If that's the case, then this tool would no longer be easy to use and would need a major rewrite.

If anyone would like to help or has any deep insight into how RR affects _ReactInternalInstance, please let us know. We'd be happy to answer any clarifying questions about our code if you're interested in contributing.

icrustandi avatar Sep 04 '17 00:09 icrustandi