Skip to content

Instantly share code, notes, and snippets.

@Ibro
Last active January 11, 2018 20:09
Show Gist options
  • Save Ibro/bba2473baeedb051adf7216811db5f53 to your computer and use it in GitHub Desktop.
Save Ibro/bba2473baeedb051adf7216811db5f53 to your computer and use it in GitHub Desktop.
Using React Router v4 with create-react-app - https://codingblast.com/react-router-create-react-app/
import React from 'react';
import './App.css';
import { BrowserRouter as Router, Route } from 'react-router-dom';
const Home = () => <h1>Home</h1>;
const Admin = () => <h1>Admin</h1>;
const App = () => (
<div className="App">
<header className="App-header">
<Router>
<div>
<Route path="/" component={Home} />
<Route path="/admin" component={Admin} />
</div>
</Router>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment