Releases: remix-run/react-router
v0.10.0
v0.9.5
v0.9.4
- e571c27 [fixed] Add .active class to
<Link>
s with absolute hrefs - ea5a380 [fixed] Make sure onChange is fired at synchronous first render
- dee374f [fixed] Listen to path changes caused by initial redirect, fixes #360
- d47d7dd [fixed] potential infinite loop during transitions
- 1b1a62b [added] Server-side rendering
- c7ca87e [added]
<Routes onError>
v0.9.3
v0.9.2
v0.9.1
v0.9.0
ActiveState
mixin isActive
isActive
is now an instance method.
// 0.7.x
var SomethingActive = React.createClass({
mixins: [ActiveState],
render: function () {
var isActive = SomethingActive.isActive(...);
}
});
// 0.9.x
var SomethingActive = React.createClass({
mixins: [ActiveState],
render: function () {
var isActive = this.isActive(...);
}
});
<Routes onActiveStateChange/>
-> <Routes onChange />
// 0.7.x
<Routes onActiveStateChange={fn} />
function fn(nextState) {}
// 0.9.x
<Routes onChange={fn} />
function fn() {
// no arguments
// `this` is the routes instance
// here are some useful methods to get at the data you probably need
this.getCurrentPath();
this.getActiveRoutes();
this.getActiveParams();
this.getActiveQuery();
}
.
in params support
.
used to be a delimiter like /
, but now its a valid character in
your params.
transition.retry()
transition.retry()
used to use transitionTo
, creating a new history
entry, it now uses replaceWith
.
// 0.7.x
React.createClass({
login: function () {
// ...
transition.retry();
}
});
// 0.9.x
React.createClass({
mixins: [Navigation],
login: function () {
// ...
this.transitionTo(transition.path);
}
});
Returning promises from transition hooks
Transition hooks are now sync, unless you opt-in to async with
transition.wait(promise)
.
// 0.7.x
React.createClass({
statics: {
willTransitionTo: function (transition) {
return somePromise();
}
}
});
// 0.9.x
React.createClass({
statics: {
willTransitionTo: function (transition) {
transition.wait(somePromise());
}
}
});
preserveScrollPosition
-> scrollBehavior
preserveScrollPosition
was totally broken and should have been named
perverseScrollPosition
.
There are now three scroll behaviors you can use:
'browser'
'scrollToTop'
'none'
browser
is the default, and imitates what browsers do in a typical
page reload scenario (preserves scroll positions when using the back
button, scrolls up when you come to a new page, etc.) Also, you can no
longer specify scroll behavior per <Route/>
anymore, only <Routes/>
<Routes scrollBehavior="scrollToTop"/>
RouteStore
This was not a public module, but we know some people were using it.
It's gone now. We have made getting at the current routes incredibly
convenient now with additions to the ActiveState
mixin.
Router.transitionTo, replaceWith, goBack
These methods have been moved to mixins.
var Router = require('react-router');
// 0.7.x
React.createClass({
whenever: function () {
Router.transitionTo('something');
Router.replaceWith('something');
Router.goBack();
}
});
// 0.9.x
var Navigation = Router.Navigation;
React.createClass({
mixins: [Navigation],
whenever: function () {
this.transitionTo('something');
this.replaceWith('something');
this.goBack();
}
});
<Routes onTransitionError onAbortedTransition/>
These were removed, there is no upgrade path in 0.9.0
but we will have
something soon. These weren't intended to be used.
ActiveState
lifecycle method updateActiveState
removed
We didn't actually need this. Just use this.isActive(to, params, query)
.
AsyncState
mixin removed
There is no upgrade path. Just use comoponentDidMount
to request
state. This was some groundwork for server-side rendering but we are
going a different direction now (using props passed in to route
handlers) so we've removed it.
Changes
- 5aae2a8 [added] onChange event to Routes
- ba65269 [removed] AsyncState
- 4d8c7a1 [removed]
<Routes onTransitionError>
- 4d8c7a1 [removed]
<Routes onAbortedTransition>
- ed0cf62 [added] Navigation mixin for components that need to modify the URL
- ed0cf62 [added] CurrentPath mixin for components that need to know the current URL path
- ed0cf62 [added] getActiveRoutes, getActiveParams, and getActiveQuery methods to ActiveState mixin
- ed0cf62 [removed] Awkward updateActiveState callback from ActiveState mixin
- ed0cf62 [removed] Router.PathState (use Router.CurrentPath instead)
- ed0cf62 [removed] Router.Transitions (use Router.Navigation instead)
- ed0cf62 [removed] Router.RouteLookup (because it was useless)
- ed0cf62 [added]
<Routes scrollBehavior="browser">
alias of "imitateBrowser" - ed0cf62 [changed]
<Routes fixedPath>
=><Routes initialPath>
will be useful for SSR
v0.8.0
Please don't upgrade to 0.8.0
, just skip to 0.9.x
.
0.8.0
had some transient mixins we didn't intend to document, but had
some miscommunication :( If you were one of three people who used some
of these mixins and need help upgrading from 0.8.0 -> 0.9.x
find us on
freenode in #rackt
or open a ticket. Thanks!
Changes
- d2aa7cb [added]
<Routes location="none">
- 637c0ac [added]
<Routes fixedPath>
- f2bf4bd [removed] RouteStore
- f2bf4bd [added] Router.PathState for keeping track of the current URL path
- f2bf4bd [added] Router.RouteLookup for looking up routes
- f2bf4bd [added] Router.Transitions for transitioning to other routes
- f2bf4bd [added] Pluggable scroll behaviors
- f2bf4bd [changed]
<Routes preserveScrollPosition>
=><Routes scrollBehavior>
- f2bf4bd [removed]
<Route preserveScrollPosition>
- f2bf4bd [removed] Router.transitionTo, Router.replaceWith, Router.goBack
- 97dbf2d [added] transition.wait(promise)
- 3787179 [changed] Transition retry now uses replaceWith.
- e0b708f [added] Ability to transitionTo absolute URLs
- c1493b5 [changed] #259 support dots in named params
- a4ce7c8 [changed] isActive is an instance method
- a4ce7c8 [removed]
<Routes onActiveStateChange>
v0.7.0
The package root modules were removed. Please import modules from the
Router
default export.
// 0.6.x
var Link = require('react-router/Link');
// 0.7.x
var Router = require('react-router');
var Link = Router.Link;