Skip to content

Instantly share code, notes, and snippets.

@gyab
Created November 28, 2016 09:17
Show Gist options
  • Save gyab/d0e29778e79856032051fea863e41510 to your computer and use it in GitHub Desktop.
Save gyab/d0e29778e79856032051fea863e41510 to your computer and use it in GitHub Desktop.
React simple routing
import React from 'react';
import ReactDOM from 'react-dom';
import Login from './Login.jsx';
//import SignUp './SignUp.jsx'
import { Router, Route, hashHistory } from 'react-router';
import './App.css';
ReactDOM.render((
<Router history={hashHistory}>
<Route path="/" component={Login}/>
<Route path="/signup" component={Login}/>
</Router>
), document.getElementById('root'))
warning.js:36 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).printWarning @ warning.js:36warning @ warning.js:60createElement @ ReactElementValidator.js:165(anonymous function) @ index.js:21(anonymous function) @ bundle.js:1363__webpack_require__ @ bundle.js:556fn @ bundle.js:87(anonymous function) @ multi_main:3(anonymous function) @ bundle.js:589__webpack_require__ @ bundle.js:556(anonymous function) @ bundle.js:579(anonymous function) @ bundle.js:582
invariant.js:38 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.(…)
import React, { Component } from 'react';
class Login extends Component {
render() {
return(
<div className="Login">
<button className="LoginButton">S'inscrire</button>
<button className="LoginButton">Se connecter</button>
</div>
)
}
}
export default Login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment