Skip to content

Update README.md #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ So eventually we've built React Universal Router, an abstraction above the Histo

Key/Value definition of routes.

```
```js
module.exports = {
'/': 'homepage',
'/designs': 'designs',
Expand All @@ -30,7 +30,7 @@ module.exports = {

Targets are the "glue" between the routes and your components.

```
```js
module.exports = {
component: MyAppComponent,
states: {
Expand All @@ -56,7 +56,7 @@ States are matching the names (values) defined in route definition(s). You can o

You need to create a new instance of Router, add route definition(s) and target definition(s).

```
```js
const options = {}
const router = new Router(options)
router.addRoutes(routes)
Expand Down Expand Up @@ -84,7 +84,7 @@ Constructor optional options with default values:
To start listening on route changes you need to add `listen` listener.
You can use it in your root component like this:

```
```js
const App = React.createClass({
getInitialState() {
return { activeComponent: router.getCurrentComponent() };
Expand All @@ -105,15 +105,15 @@ const App = React.createClass({

Or in a similar fashion as the React router:

```
```js
router.listen(component => React.render(component, mountElement));
```

#### Changing the route

You can change the route by calling the `transitionTo` method and a name of the route defined in route definition(s).

```
```js
// Simple transition to a different page
const { transitionTo } = router.getRouterProps();
transitionTo('designs');
Expand Down