Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

How to Add a New Page

ragingsquirrel3 edited this page Oct 6, 2016 · 3 revisions
  • Create a branch off the development branch.
  • Add your route to the bottom src/server.py, so that it looks like
# render user interfaces in client JS
@app.route('/')
@app.route('/about')
@app.route('/help')
@app.route('/search')
# add this
@app.route('/new_page')
# 
def react_render():
        return render_template('index.jinja2')
  • Create a React component by copying the example component. You can do this by running
$  cp -r src/js_src/containers/example/  src/js_src/containers/newPage
  • Add the new component the react router by importing the component and adding to routes in src/js_src/routes.js, making the path match the one you added to the server.
import React from 'react';
import { IndexRoute, Route  } from 'react-router';

import About from './containers/about';
import Home from './containers/home';
import Layout from './containers/layout';
import Search from './containers/search';
// add this
import NewComponent from './containers/newPage';

export default (
  <Route component={Layout} path='/'>
    <IndexRoute component={Home} />
    <Route component={About} path='about' />
    <Route component={Search} path='search' />
    <Route component={NewComponent} path='new_page' />
  </Route>
);
Clone this wiki locally