Skip to content

Releases: remix-run/react-router

v1.0.0-beta3

10 Nov 17:23
Compare
Choose a tag to compare
v1.0.0-beta3 Pre-release
Pre-release

v1.0.0-beta2

10 Nov 17:22
Compare
Choose a tag to compare
v1.0.0-beta2 Pre-release
Pre-release

v1.0.0-beta1

10 Nov 17:22
Compare
Choose a tag to compare
v1.0.0-beta1 Pre-release
Pre-release

v1.0.0-alpha2

10 Nov 17:21
Compare
Choose a tag to compare
v1.0.0-alpha2 Pre-release
Pre-release

v0.13.3

10 Nov 17:15
Compare
Choose a tag to compare
v0.13.3 Pre-release
Pre-release

v0.13.2

10 Nov 17:14
Compare
Choose a tag to compare
v0.13.2 Pre-release
Pre-release
  • 4a8b756 [fixed] empty query strings not being removed
  • 1b2293b [fixed] use context in examples
  • 4af3c18 [fixed] HashLocation triggers 'replace' state on transition.redirect()
  • 59c28de [fixed] Empty query string now routes correctly
  • f5d4f36 [fixed] Docs Update

v0.13.1

10 Nov 17:14
Compare
Choose a tag to compare
v0.13.1 Pre-release
Pre-release
  • d12e9dee Use Router instead of this now that autobinding is off

v0.13.0

10 Nov 17:12
Compare
Choose a tag to compare
v0.13.0 Pre-release
Pre-release

React introduced the ability to use ES6 classes for component definitions, which has the side-effect of mixins not being "the thing" anymore. Our mixins like State and Navigation just proxied calls to some methods on an undocumented feature of React called context, that in turn called methods on the router instance under the hood.

Without mixins we needed a way for you to get access to these methods. We decided the simplest solution was to stop hiding the router instance and just put the whole thing on context.

You can think about context as values that are floating around a render tree that parent components (Handler in the Router.run callback) can explicitly define and descendent components can explicitly ask for. The stuff on context doesn't show up in a component unless you ask for it.

Note: You can still use our mixins, you'll just get a deprecation warning.

// 0.12.x
var Foo = React.createClass({
  mixins: [ Router.State ],
  render: function () {
    var id = this.getParams().id;
    var searchTerm = this.getQuery().searchTerm;
    // etc. ...
  }
});

// 0.13.x w/o ES6 fanciness
var Foo = React.createClass({
  contextTypes: {
    router: React.PropTypes.func
  },

  render: function () {
    var router = this.context.router;
    var id = router.getCurrentParams().id;
    var searchTerm = router.getCurrentQuery().searchTerm;
    // etc.
  }
});

// 0.13.x w/ ES6 fanciness
class Foo extends React.Component {
  render () {
    var { router } = this.context;
    var id = router.getCurrentParams().id;
    var searchTerm = router.getCurrentQuery().searchTerm;
    // etc.
  }
}

Foo.contextTypes = {
  router: React.PropTypes.func
};

Most of the time we prefer to just pass the state down the props tree
and not mess with context:

Router.run(routes, (Handler, state) => {
  React.render(<Handler {...state}/>, document.body);
});

// and then when rendering route handlers, keep passing it down
<RouteHandler {...this.props}/>

// and then in your methods you have what you need on props
var id = this.props.params.id;
var searchTerm = this.props.query.searchTerm;

Changes

  • f3a44f1 [fixed] React 0.13 compatibility
  • 559c604 [changed] Use empty bracket notation for arrays
  • 07b4972 [fixed] Allow repetition in child paths
  • 696a706 [fixed] Use defaultProps of config components
  • 61f0a8c [changed] Deprecate Navigation/State mixins

v0.12.4

10 Nov 17:11
Compare
Choose a tag to compare
v0.12.4 Pre-release
Pre-release

v0.12.3

10 Nov 17:11
Compare
Choose a tag to compare
v0.12.3 Pre-release
Pre-release
  • aef0dce [fixed] DefaultRoute/NotFoundRoute name regression