mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
init react
This commit is contained in:
9
client/js/pages/Index.js
Normal file
9
client/js/pages/Index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
|
||||
export default class Index extends React.Component{
|
||||
render(){
|
||||
return(
|
||||
<div>This is the index test component</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
22
client/js/routes.js
Normal file
22
client/js/routes.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import {browserHistory, Router, Route, IndexRoute} from 'react-router';
|
||||
|
||||
import Index from './pages/Index';
|
||||
|
||||
class App extends React.Component{
|
||||
render(){
|
||||
return(
|
||||
<div>{React.cloneElement(this.props.children, this.props)}</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render((
|
||||
<Router history={browserHistory}>
|
||||
<Route path="/" component={App}>
|
||||
<IndexRoute component={Index}/>
|
||||
<Route path="/test" component={Index}/>
|
||||
</Route>
|
||||
</Router>
|
||||
),document.getElementById('app'));
|
||||
Reference in New Issue
Block a user