Of course, RRC is not as battle-tested as React-Router; it's more of a "works for us" project I took over from @andreypopp as we had already committed to the router before React-Router became stable. And given the many backcompat-breaking changes to React-Router, it seems to have been a good idea.
React-Router does great work though; RRC doesn't even pretend to do React Native and the Environment selection we do have (pathname, pushstate, etc) isn't quite as nice. RRC also can't do some of the more interesting features, like Recursive Routes. All of the children of the router have to be `<Location>` objects.
Edit: React-Router's docs are awesome! Nice work @ryanflorence.
The docs are super good. I love the "embedded browser" that shows how it works.
Shameless self plug: our book [1] has a whole chapter on Routing in React with this new v4 router. After you've finished reading the docs, if you want a tutorial style walk-through of this router v4, we build a Spotify-type clone over the course of 75+ pages.
Over the last month (or so), I've been reading and reviewing React books on my blog [1]. I liked Fullstack React, but there is one big thing that keeps me from recommending it: most of the examples still use the createClass from ES5. For learning React in 2017, I (just my opinion) expect the book to fully embrace ES6/7 in all the examples.
react-navigation will supersede all existing navigator solutions in React Native core (Navigator/NavigationExperimental).
React Router v4 is building a react-native integration to show that it is capable of working on Native. It's centered around URLs so it's attempting to make Deep Linking into your application easier, as well potentially re-using the same navigation on the web.
That being said react-navigation can do both of those things as well and is fully supported by react-native core contributors.
I definitely like the way they decided to move in the latest version. I never was comfortable with the previous API -- it just didn't feel right, and it was kind of restrictive.
Will there be a way to access query / search parameters? The URL Parameters example could benefit from a such an addition, if it's already possible. Something showing how to get the genre out of `/netflix?genre=mystery` would be lovely.
you get location.search, which is just a string. We removed default query handling because it can be composed in with something like `RouteWithQuery` and `LinkWithQuery`. Lots of people didn't want the default serialization anyway. It's like 7 lines, we'll have an example of it you can copy/paste.
i like the power of the new API but i'm not sure i'm entirely sold on the declaration syntax. adjacent <Route/> tags which specify things that may appear in the same place depending on the route seems a bit strange conceptually to me. i'll have to play around with it on a real-world project to see how it feels in practice.
i didn't see it mentioned in the docs, but does the new version fix the awkward handling of scrolling and history?
I look forward to the day where people can improve upon their project based on gained knowledge without passive aggressive comments about the lack of back compat.
This is how software improves. You are not forced to upgrade to the next version.
This is a huge step forward in react routing. I'm still on v3, but very excited to switch. I love that I don't have to separate my thinking about routes vs normal components.
Ex. If I want to lazy load a route vs something below the fold, I can use the same HOC for both.
Slightly off topic, but do you find that docs really need to be mobile friendly? I'd personally rather the developer focuses on the actual project and all those concerns rather than a perfect responsive docs page. Esp when assuming most of these docs are eventually translated into markdown on github which are then mobile friendly.
I was going to complain about churn and such, but we've all heard the JavaScript framework fatigue story a thousand times.
I'll summarize it to this: don't expect a solid, stable, boring library to come out of someone's hobby project.
React itself bloomed under Facebook's stewardship, while all the other libraries in the ecosystem are bouncing all over the place without anything to keep them in place, especially after they lose their initial shine and geek points.
Kudos to the authors for their achievements. I don't recall you promising anything to anybody, so any code you put out contributes something to the world, even if you get bored and change the API from procedural to declarative and back three times a day.
Following stable releases we had one breaking API change in 2 years from 0.13 -> 1.0. 2.0 was fully BC, 3.0 removed 1.0 API 8 months after 2.0 was released. People shouldn't install beta/alpha like its stable and then complain to us about it.
I couldn't find it on the website, is there a detailed list of the changelog for this beta? Looks like some really great changes were made, but would love to see specifics.
We're working on an upgrade guide, but in short, it's a completely different library. Major difference is that routes are actual components that are actually rendered, where before they just had their props stripped and plugged into the routing machine. Now your routing is composed like the rest of your react app.
STRML|9 years ago
Of course, RRC is not as battle-tested as React-Router; it's more of a "works for us" project I took over from @andreypopp as we had already committed to the router before React-Router became stable. And given the many backcompat-breaking changes to React-Router, it seems to have been a good idea.
React-Router does great work though; RRC doesn't even pretend to do React Native and the Environment selection we do have (pathname, pushstate, etc) isn't quite as nice. RRC also can't do some of the more interesting features, like Recursive Routes. All of the children of the router have to be `<Location>` objects.
Edit: React-Router's docs are awesome! Nice work @ryanflorence.
ryanflorence|9 years ago
We had breaking changes from 0.13 to 1.0.
Then complete BC from 1.0 to 2.0
That's two years, one breaking upgrade.
Don't confuse a libs "changing API" with "people use the development branch as stable".
unknown|9 years ago
[deleted]
jashmenn|9 years ago
Shameless self plug: our book [1] has a whole chapter on Routing in React with this new v4 router. After you've finished reading the docs, if you want a tutorial style walk-through of this router v4, we build a Spotify-type clone over the course of 75+ pages.
[1]: https://www.fullstackreact.com
jmcunningham|9 years ago
[1]: https://medium.com/@jmcunningham/
mxstbr|9 years ago
salimmadjd|9 years ago
DGCA|9 years ago
^ helped me understand what changes are coming.
ivansavz|9 years ago
Awesome docs, BTW!
ryanflorence|9 years ago
browniefed|9 years ago
React Router v4 is building a react-native integration to show that it is capable of working on Native. It's centered around URLs so it's attempting to make Deep Linking into your application easier, as well potentially re-using the same navigation on the web.
That being said react-navigation can do both of those things as well and is fully supported by react-native core contributors.
evv|9 years ago
1) In RR, nav state is the URI. Because mobile nav state is complex, React Navigation treats URIs as actions to modify a more complex navigation state
2) RR uses React Components for navigation logic. In React Navigation, the isolated nav logic is statically available, (without rendering).
3) React Navigation is composable, so navigators can be configured to delegate navigation logic to child routers.
joekrill|9 years ago
ryanflorence|9 years ago
karthik248|9 years ago
shepmaster|9 years ago
asidiali|9 years ago
ryanflorence|9 years ago
yasserkaddour|9 years ago
arrakeen|9 years ago
i didn't see it mentioned in the docs, but does the new version fix the awkward handling of scrolling and history?
ryanflorence|9 years ago
colept|9 years ago
miralize|9 years ago
This is how software improves. You are not forced to upgrade to the next version.
ryanflorence|9 years ago
That was 2 years with only one breaking change.
2.0 -> 3.0 removed deprecated 1.0 API, fully BC with 2.0
The only churn is for people who don't stick to stable releases, and that's their own problem.
christopher_|9 years ago
dabit3|9 years ago
griffinmichl|9 years ago
Ex. If I want to lazy load a route vs something below the fold, I can use the same HOC for both.
interlocutor|9 years ago
jdormit|9 years ago
bluetidepro|9 years ago
ryanflorence|9 years ago
kentor|9 years ago
tga|9 years ago
I'll summarize it to this: don't expect a solid, stable, boring library to come out of someone's hobby project.
React itself bloomed under Facebook's stewardship, while all the other libraries in the ecosystem are bouncing all over the place without anything to keep them in place, especially after they lose their initial shine and geek points.
Kudos to the authors for their achievements. I don't recall you promising anything to anybody, so any code you put out contributes something to the world, even if you get bored and change the API from procedural to declarative and back three times a day.
ryanflorence|9 years ago
bluetidepro|9 years ago
ryanflorence|9 years ago
kentor|9 years ago