Skip to content

React router errors #12

@yarnball

Description

@yarnball

Hi,

This looks great. I'm having trouble with the react part.

I have attached a screenshot of the errors. I think the main one is to do with React Router.

Could you please assist with setting it up correctly? I've used create-react-app as the boilderplate.

Also, here is is on my repo:
https://github.com/yarnball/ReactDjangoAuth

Thanks

import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, hashHistory } from 'react-router';
import App from './App';
import './index.css';
import Login from './auth/login'
import auth from './auth/auth'


function requireAuth(nextState, replace) {
    if (!auth.loggedIn()) {
        replace({ 
            pathname:'/app/login/',
            state: {nextPathname: '/app/'}
        })
    }
}
ReactDOM.render(
    <Router history={hashHistory}>
        <Router path='/app/login/' component={Login} />
        <Router path='/app/' component={App} onEnter={requireAuth} />
    </Router>,
  document.getElementById('app')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions