Skip to content

Commit

Permalink
[changed] Deprecate Router interface
Browse files Browse the repository at this point in the history
The Router interface is deprecated in favor of using <Route>
components directly with React.renderComponent.
  • Loading branch information
mjackson committed Jun 24, 2014
1 parent cd74bbd commit 468bf3b
Show file tree
Hide file tree
Showing 19 changed files with 583 additions and 666 deletions.
9 changes: 5 additions & 4 deletions examples/dynamic-segments/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ var Task = React.createClass({
}
});

Router(
var router = Router({},
<Route handler={App}>
<Route name="user" path="user/:userId" handler={User}>
<Route name="task" path="user/:userId/tasks/:taskId" handler={Task}/>
<Route name="user" path="/user/:userId" handler={User}>
<Route name="task" path="/user/:userId/tasks/:taskId" handler={Task}/>
</Route>
</Route>
).renderComponent(document.body);
);

React.renderComponent(router, document.body);
13 changes: 8 additions & 5 deletions examples/query-params/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ var User = React.createClass({
}
});

Router(
<Route handler={App}>
<Route name="user" path="user/:userId" handler={User}/>
</Route>
).renderComponent(document.body);
var router = (
<Router>
<Route handler={App}>
<Route name="user" path="user/:userId" handler={User}/>
</Route>
</Router>
);

React.renderComponent(router, document.body);
16 changes: 9 additions & 7 deletions examples/transitions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var Form = React.createClass({
handleSubmit: function(event) {
event.preventDefault();
this.refs.userInput.getDOMNode().value = '';
Router.transitionTo('/');
ReactRouter.transitionTo('/');
},

render: function() {
Expand All @@ -56,10 +56,12 @@ var Form = React.createClass({
}
});

Router(
<Route handler={App}>
<Route name="dashboard" handler={Dashboard} />
<Route name="form" handler={Form} />
</Route>
).renderComponent(document.body);
var router = (
<Route handler={App}>
<Route name="dashboard" handler={Dashboard} />
<Route name="form" handler={Form} />
</Route>
);

React.renderComponent(router, document.body);

102 changes: 0 additions & 102 deletions modules/Route.js

This file was deleted.

Loading

0 comments on commit 468bf3b

Please sign in to comment.