Skip to content

Instantly share code, notes, and snippets.

@undernewmanagement
Created September 8, 2014 20:48
Show Gist options
  • Save undernewmanagement/7062628d1de5ab431d65 to your computer and use it in GitHub Desktop.
Save undernewmanagement/7062628d1de5ab431d65 to your computer and use it in GitHub Desktop.
React-router
/** @jsx React.DOM */
var React = require('react'),
Router = require('react-router'),
Route = Router.Route,
Routes = Router.Routes,
Link = Router.Link,
App = require('./components/App.jsx'),
Dashboard = require('./components/Dashboard.jsx');
Clients = require('./modules/clients/components/Main.jsx'),
Brands = require('./modules/brands/components/Main.jsx'),
Locations = require('./modules/locations/components/Main.jsx'),
Items = require('./modules/items/components/Main.jsx');
//Offers = require('./modules/offers/components/Main.jsx');
var routes = (
<Routes>
<Route handler={App}>
<Route name="dashboard" path="/" handler={Dashboard}/>
<Route name="brands" path="/brands" handler={Brands}/>
<Route name="clients" path="/clients" handler={Clients}/>
<Route name="locations" path="/clients/:client_id/locations" handler={Locations}/>
// getting error: No route matches path "clients/6/locations/16/items". Make sure you have <Route path="clients/6/locations/16/items"> somewhere in your routes
<Route name="items" path="/clients/:client_id/locations/:location_id/items" handler={Items}/>
</Route>
</Routes>
);
React.renderComponent(routes, document.getElementById('app'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment