I am trying to use reactjs
and react-router
(1.x
) with my Django application but I am having a hard time putting all this together. Here is the github project just incase I dont provide enough information within this question.
https://github.com/liondancer/django-cherngloong
I created a path="about"
within my routes.js
var routes = (
<Router>
<Route path="/" component={ Views.Layout }>
<IndexRoute component={ Views.Index } />
<Route path="about" component={ Views.About } />
</Route>
<Route path="*" component={ Views.RouteNotFound } />
</Router>
);
export default routes;
My layout.js
class Layout extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div id="review-web">
<header className="header">
<LogoElement />
<CenterPiece />
</header>
<div>
{ React.cloneElement(this.props.children, { path: this.props.path }) }
</div>
<Footer />
</div>
);
}
}
export default Layout;
When I enter in localhost.8000/about
I get a 404
Django error
My goal is to keep the frontend and backend separate so I believe I should be able to use Django as just an endpoint for data and not for rendering views.