Commit dfb0643d authored by Zach Osman's avatar Zach Osman

Simple react router implementation

parent 76d017df
Pipeline #3203 passed with stage
in 57 seconds
...@@ -5,7 +5,7 @@ export default class HomePage extends React.Component { ...@@ -5,7 +5,7 @@ export default class HomePage extends React.Component {
render() { render() {
return ( return (
<div> <div>
<p>Hello World!</p> <p>Hello World! 1</p>
</div> </div>
); );
} }
......
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter, Route, Link } from 'react-router-dom';
import { HomePage } from './Components'; import { HomePage } from './Components';
// const App = () => ( const Dhaynes = () => <p>dhaynes</p>;
// <div>
// <Header /> const App = () => (
// <HomePage /> <div>
// </div> <ul>
// ); <li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/dhaynes">dhaynes</Link>
</li>
</ul>
<Route path="/" exact component={HomePage} />
<Route path="/dhaynes" component={Dhaynes} />
</div>
);
ReactDOM.render( ReactDOM.render(
<BrowserRouter> <BrowserRouter>
<HomePage /> <App />
</BrowserRouter>, </BrowserRouter>,
document.getElementById('root') document.getElementById('root')
); );
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"private": false, "private": false,
"scripts": { "scripts": {
"start": "yarn dev",
"dev": "webpack --mode development ./go/go_ahead/src/index.js --output ./go/static/main.js --watch", "dev": "webpack --mode development ./go/go_ahead/src/index.js --output ./go/static/main.js --watch",
"build": "webpack --mode production ./project/frontend/src/index.js --output ./go/static/main.js" "build": "webpack --mode production ./project/frontend/src/index.js --output ./go/static/main.js"
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment