TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

React Router: Declarative Routing for React

87 点作者 tm33超过 8 年前

16 条评论

STRML超过 8 年前
The new API looks quite a bit like the API we&#x27;ve been running in React-Router-Component since 2014 (<a href="https:&#x2F;&#x2F;github.com&#x2F;STRML&#x2F;react-router-component" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;STRML&#x2F;react-router-component</a>).<p>Of course, RRC is not as battle-tested as React-Router; it&#x27;s more of a &quot;works for us&quot; 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.<p>React-Router does great work though; RRC doesn&#x27;t even pretend to do React Native and the Environment selection we do have (pathname, pushstate, etc) isn&#x27;t quite as nice. RRC also can&#x27;t do some of the more interesting features, like Recursive Routes. All of the children of the router have to be `&lt;Location&gt;` objects.<p>Edit: React-Router&#x27;s docs are awesome! Nice work @ryanflorence.
评论 #13523726 未加载
评论 #13523472 未加载
jashmenn超过 8 年前
The docs are super good. I love the &quot;embedded browser&quot; that shows how it works.<p>Shameless self plug: our book [1] has a whole chapter on Routing in React with this new v4 router. After you&#x27;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.<p>[1]: <a href="https:&#x2F;&#x2F;www.fullstackreact.com" rel="nofollow">https:&#x2F;&#x2F;www.fullstackreact.com</a>
评论 #13524096 未加载
评论 #13523514 未加载
评论 #13523324 未加载
DGCA超过 8 年前
Link to v4 branch: <a href="https:&#x2F;&#x2F;github.com&#x2F;ReactTraining&#x2F;react-router&#x2F;tree&#x2F;v4" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ReactTraining&#x2F;react-router&#x2F;tree&#x2F;v4</a><p>^ helped me understand what changes are coming.
ivan_ah超过 8 年前
Could someone comment about how this compares with other projects like: <a href="https:&#x2F;&#x2F;github.com&#x2F;react-community&#x2F;react-navigation" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;react-community&#x2F;react-navigation</a> and <a href="https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;react-native&#x2F;blob&#x2F;master&#x2F;docs&#x2F;UsingNavigators.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;react-native&#x2F;blob&#x2F;master&#x2F;docs&#x2F;Us...</a> ?<p>Awesome docs, BTW!
评论 #13523438 未加载
评论 #13523404 未加载
评论 #13523543 未加载
joekrill超过 8 年前
I definitely like the way they decided to move in the latest version. I never was comfortable with the previous API -- it just didn&#x27;t feel right, and it was kind of restrictive.
评论 #13523084 未加载
评论 #13523402 未加载
shepmaster超过 8 年前
Will there be a way to access query &#x2F; search parameters? The URL Parameters example could benefit from a such an addition, if it&#x27;s already possible. Something showing how to get the genre out of `&#x2F;netflix?genre=mystery` would be lovely.
评论 #13524138 未加载
评论 #13526918 未加载
评论 #13525151 未加载
arrakeen超过 8 年前
i like the power of the new API but i&#x27;m not sure i&#x27;m entirely sold on the declaration syntax. adjacent &lt;Route&#x2F;&gt; tags which specify things that may appear in the same place depending on the route seems a bit strange conceptually to me. i&#x27;ll have to play around with it on a real-world project to see how it feels in practice.<p>i didn&#x27;t see it mentioned in the docs, but does the new version fix the awkward handling of scrolling and history?
评论 #13523393 未加载
colept超过 8 年前
I look forward to the next API revision. Churning your API frequently turns me off as a developer who would rather not be deprecated out the gate.
评论 #13523719 未加载
评论 #13524581 未加载
christopher_超过 8 年前
Been using V4 since they released alpha and it really is a great piece of software. Great work Michael and Ryan.
评论 #13523115 未加载
griffinmichl超过 8 年前
This is a huge step forward in react routing. I&#x27;m still on v3, but very excited to switch. I love that I don&#x27;t have to separate my thinking about routes vs normal components.<p>Ex. If I want to lazy load a route vs something below the fold, I can use the same HOC for both.
interlocutor超过 8 年前
If you want to use React as the V in MVC you can always use a MVC router instead: <a href="https:&#x2F;&#x2F;github.com&#x2F;rajeev-k&#x2F;mvc-router" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rajeev-k&#x2F;mvc-router</a>
jdormit超过 8 年前
The website is broken on mobile - elements overlap and content is not visible.
评论 #13523399 未加载
评论 #13523409 未加载
kentor超过 8 年前
The code has 1 font with no backup:<p><pre><code> font-family: Monaco; </code></pre> I don&#x27;t have Monaco on Windows so it&#x27;s using Times New Roman :\
tga超过 8 年前
I was going to complain about churn and such, but we&#x27;ve all heard the JavaScript framework fatigue story a thousand times.<p>I&#x27;ll summarize it to this: don&#x27;t <i>expect</i> a solid, stable, boring library to come out of someone&#x27;s hobby project.<p>React itself bloomed under Facebook&#x27;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.<p>Kudos to the authors for their achievements. I don&#x27;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.
评论 #13526962 未加载
bluetidepro超过 8 年前
I couldn&#x27;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.
评论 #13523197 未加载
kentor超过 8 年前
Will there be a way to prevent transitions when clicking on a link that isn&#x27;t hooked into react router?