3 ms·
I haven't really given the routing issue too much thought regarding ReactJS.NET. I assumed it would work just as well as my isomorphic apps in NodeJS; one route
by xtrumanx 12y ago
I haven't really given the routing issue too much thought regarding ReactJS.NET. I assumed it would work just as well as my isomorphic apps in NodeJS; one route in server-side land that handles all URLs and returns a View that contains the server-side rendered React app. I maybe missing something for why that wouldn't work in ASP.NET land but like I said, I haven't worked with it that much.
react-router is all right and they've got server-side rendering working but it's still missing one very important facet that is required for most isomorphic apps; the initial server-side render should be capable of fetching whatever data is needed is fully render the page. Right now the best you could do is deliver a page with a spinner if the page requires some data on the initial render. Andrey Popp's react-router-component solved this issue by using react-async which uses fibers to allows for getInitialState to work asynchronously. The react-router guys think the "fibers stuff is stupid"[0] but they're still working on their own solution to the problem.
The only reason I'm still keeping tabs on react-router instead of abandoning it for react-router-component is that it doesn't look like Andrey Popp's is going to be maintaining react-router-component and react-router seems like the only other game in town when it comes to routing in React.
[0] https://github.com/rackt/react-router/issues/57#issuecomment-49193293 https://github.com/rackt/react-router/issues/57#issuecomment...
P.S. I don't know that much about node and fibers to understand why fibers is stupid but it solves the problem and from what I read about fibers, it seems like the node community just don't like it because it resembles threads and they don't like threads in node.
- Todd 12y agoIt looks like they may have recently solved the issue with async rendering on the server (4 days ago): https://github.com/rackt/react-router/wiki/Announcements#whats-the-deal-with-the-new-api https://github.com/rackt/react-router/wiki/Announcements#wha... One of the exciting things about React, and Node.js more generally, is how quickly it is moving. This usually means that there are sharp edges and rough patches and that's been my experience so far. I'll take that any day over a backwater that gets no attention. I am going to spend some time with react-router, since it looks like the one that is gaining the most traction. To my comment above, they do support nested views, which appears to solve the layout issue for me.
- xtrumanx 12y agoThanks for the heads up. The link seems to redirect back to the project page but I found its contents via Google's cache. It's awesome that they've apparently solved the issue. Haven't quite grokked the example but will study it further.
- Todd 12y agoYes, that was strange. I noticed it was removed shortly after I posted my comment. I can only assume they want to clean up the examples in the announcement and integrate them into the docs. Here's where I saw the original link: https://twitter.com/ryanflorence/status/536940145241763840 https://twitter.com/ryanflorence/status/536940145241763840