Skip to content

Commit

Permalink
add react-router examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vinogradov committed Aug 8, 2017
1 parent 3c1e474 commit cd998f2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ import './examples/react/index';
// import './examples/redux/one-file';
// import './examples/redux/separate-files';
// import './examples/redux/separate-files-redux-actions';
// import './examples/router';
4 changes: 2 additions & 2 deletions src/examples/react/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import React from 'react';
import ReactDOM from 'react-dom';
import {Hello} from './hello';

ReactDOM.render(
Expand Down
27 changes: 27 additions & 0 deletions src/examples/router/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {BrowserRouter, Link, Route} from 'react-router-dom';

const Route1 = () => <h2>Route1</h2>;
const Route2 = () => <h2>Route2</h2>;

const App = (props) => {
console.log('App', props); // eslint-disable-line no-console

return (
<div>
<p><Link to="/route1">route1</Link></p>
<p><Link to="/route2">route2</Link></p>

<Route path="/route1" component={Route1} />
<Route path="/route2" component={Route2} />
</div>
);
};

ReactDOM.render(
<BrowserRouter>
<Route component={App} />
</BrowserRouter>,
document.querySelector('#app')
);

0 comments on commit cd998f2

Please sign in to comment.