integrated react-router

This commit is contained in:
Tim Daubenschütz 2015-05-15 15:38:25 +02:00
parent 2b8f46cb8c
commit 4d7198fab9
4 changed files with 38 additions and 6 deletions

View File

@ -1,10 +1,22 @@
'use strict';
import React from 'react';
import HelloApp from './components/hello_app';
import Router from 'react-router';
React.render(
<HelloApp />,
document.getElementById('main')
import HelloApp from './components/hello_app';
import ArtworkList from './components/artwork_list';
var Route = Router.Route;
var routes = (
<Route handler={HelloApp}>
<Route path="artworks" handler={ArtworkList}/>
</Route>
);
Router.run(routes, Router.HashLocation, (HelloApp) => {
React.render(
<HelloApp />,
document.getElementById('main')
);
});

View File

@ -0,0 +1,13 @@
import React from 'react';
class ArtworkList extends React.Component {
render () {
return (
<ul>
<li>This is an artwork</li>
</ul>
);
}
};
export default ArtworkList;

View File

@ -1,9 +1,15 @@
import React from 'react';
import Router from 'react-router';
var RouteHandler = Router.RouteHandler;
class HelloApp extends React.Component {
render () {
return (
<h1>ascribe all the things!</h1>
<div>
<h1>ascribe all the things!</h1>
<RouteHandler/>
</div>
);
}
};

View File

@ -29,7 +29,8 @@
"alt": "^0.15.6",
"classnames": "^1.2.2",
"object-assign": "^2.0.0",
"react": "^0.13.2"
"react": "^0.13.2",
"react-router": "^0.13.3"
},
"jest": {
"scriptPreprocessor": "node_modules/babel-jest",