Skip to content

Commit 645c5f8

Browse files
committed
Updated the examples to use the history singleton
1 parent 587e54f commit 645c5f8

File tree

12 files changed

+24
-23
lines changed

12 files changed

+24
-23
lines changed

examples/animations/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { cloneElement } from 'react/addons';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
import { Router, Route, Link } from 'react-router';
44

55
var { CSSTransitionGroup } = React.addons;
@@ -46,7 +46,7 @@ var Page2 = React.createClass({
4646

4747

4848
React.render((
49-
<Router history={new HashHistory}>
49+
<Router history={history}>
5050
<Route path="/" component={App}>
5151
<Route path="page1" component={Page1} />
5252
<Route path="page2" component={Page2} />

examples/async-data/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
import { Router, Route, Link, Navigation } from 'react-router';
44
import { loadContacts, loadContact, createContact } from './utils';
55
import AsyncProps from 'react-router/lib/experimental/AsyncProps';
@@ -106,7 +106,7 @@ var Index = React.createClass({
106106
});
107107

108108
React.render((
109-
<Router history={new HashHistory} createElement={AsyncProps.createElement}>
109+
<Router history={history} createElement={AsyncProps.createElement}>
110110
<Route component={AsyncProps} renderInitialLoad={() => <Spinner/> }>
111111
<Route component={App}>
112112
<Route path="/" component={Index}/>

examples/auth-flow/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { findDOMNode } from 'react';
22
import { Router, Route, Link, Navigation } from 'react-router';
33
import HashHistory from 'react-router/lib/HashHistory';
44
import auth from './auth';
5+
var history = new HashHistory({ queryKey: true });
56

67
var App = React.createClass({
78
getInitialState() {
@@ -120,7 +121,7 @@ function requireAuth(nextState, transition) {
120121
}
121122

122123
React.render((
123-
<Router history={new HashHistory({ queryKey: true })}>
124+
<Router history={history}>
124125
<Route path="/" component={App}>
125126
<Route path="login" component={Login}/>
126127
<Route path="logout" component={Logout}/>

examples/dynamic-segments/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
import { Router, Route, Link, Redirect } from 'react-router';
44

55
var App = React.createClass({
@@ -47,7 +47,7 @@ var Task = React.createClass({
4747
});
4848

4949
React.render((
50-
<Router history={new HashHistory}>
50+
<Router history={history}>
5151
<Route path="/" component={App}>
5252
<Route path="user/:userID" component={User}>
5353
<Route path="tasks/:taskID" component={Task}/>

examples/huge-apps/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
import { Router } from 'react-router';
44
import AsyncProps from 'react-router/lib/experimental/AsyncProps';
55
import stubbedCourses from './stubs/COURSES';
@@ -28,7 +28,7 @@ var rootRoute = {
2828
React.render((
2929
<Router
3030
routes={rootRoute}
31-
history={new HashHistory}
31+
history={history}
3232
createElement={AsyncProps.createElement}
3333
/>
3434
), document.getElementById('example'));

examples/master-detail/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { findDOMNode } from 'react';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
import { Router, Navigation, Route, Link } from 'react-router';
44
import ContactStore from './ContactStore';
55

@@ -150,7 +150,7 @@ var NotFound = React.createClass({
150150
});
151151

152152
React.render((
153-
<Router history={new HashHistory}>
153+
<Router history={history}>
154154
<Route component={App}>
155155
<Route path="/" component={Index}/>
156156
<Route path="contact/new" component={NewContact}/>

examples/passing-props-to-children/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var React = require('react');
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
var { Router, Route, Link, Navigation } = require('react-router');
44

55
var App = React.createClass({
@@ -72,7 +72,7 @@ var Taco = React.createClass({
7272
});
7373

7474
React.render((
75-
<Router history={new HashHistory}>
75+
<Router history={history}>
7676
<Route path="/" component={App}>
7777
<Route path="taco/:name" component={Taco}/>
7878
</Route>

examples/pinterest/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { Router, Link } from 'react-router';
33
import HashHistory from 'react-router/lib/HashHistory';
4+
var history = new HashHistory({ queryKey: 'k' });
45

56
var pictures = [
67
{id: 0, src: 'http://placekitten.com/601/601'},
@@ -127,7 +128,7 @@ var RootRoute = {
127128
};
128129

129130
React.render(
130-
<Router history={new HashHistory({ queryKey: 'k' })} children={RootRoute}/>,
131+
<Router history={history} children={RootRoute}/>,
131132
document.getElementById('example')
132133
);
133134

@@ -160,4 +161,3 @@ React.render(
160161
//
161162
// 10. I am very glad there aren't ten steps to explain this ...
162163
//
163-

examples/query-params/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
import { Router, Route, Link } from 'react-router';
44

55
var User = React.createClass({
@@ -32,7 +32,7 @@ var App = React.createClass({
3232
});
3333

3434
React.render((
35-
<Router history={new HashHistory}>
35+
<Router history={history}>
3636
<Route path="/" component={App}>
3737
<Route path="user/:userID" component={User}/>
3838
</Route>

examples/shared-root/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import HashHistory from 'react-router/lib/HashHistory';
2+
import { history } from 'react-router/lib/HashHistory';
33
import { Router, Route, Link } from 'react-router';
44

55
var App = React.createClass({
@@ -70,7 +70,7 @@ var ForgotPassword = React.createClass({
7070
});
7171

7272
React.render((
73-
<Router history={new HashHistory}>
73+
<Router history={history}>
7474
<Route path="/" component={App}>
7575
<Route component={SignedOut}>
7676
<Route path="signin" component={SignIn}/>

0 commit comments

Comments
 (0)