Commit 541ca8fc authored by Martin Wighus Holtmon's avatar Martin Wighus Holtmon
Browse files

firstpart/Problem5 - Made use of router to redirect. I am not sure If i...

firstpart/Problem5 - Made use of router to redirect. I am not sure If i modified the DOM or not or If I have proper MVC decomposition.
Also removed unused imports.
parent 92c4b5df
......@@ -8,7 +8,6 @@ import './Example.css';
import Prism from 'prismjs';
import 'prismjs/components/prism-jsx.js';
import '../../node_modules/prismjs/themes/prism.css';
import Header from "../header/Header";
/* eslint-disable react/jsx-one-expression-per-line */
/* eslint-disable react/destructuring-assignment */
......
import React from 'react';
import './States.css';
import Header from "../header/Header";
/**
* Define States, a React componment of CS142 project #4 problem #2. The model
......
<!doctype html>
<html>
<head>
<title>CS142 Class Project</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="modelData/states.js"></script>
<script src="modelData/example.js"></script>
</head>
<body>
<div id="reactapp">
<script src="compiled/p5.bundle.js"></script>
</div>
</body>
</html>
import React from 'react';
import ReactDOM from 'react-dom';
import {HashRouter, Route, Link, Redirect} from "react-router-dom";
import States from './components/states/States';
import Example from './components/example/Example';
import Header from "./components/header/Header";
class P5 extends React.Component {
render() {
return(
<div>
<Header />
<HashRouter>
<Link to="/states">States</Link>
<Link to="/example">Example</Link>
<Route exact path="/">
<Redirect to="/example" />
</Route>
<Route exact path="/example" component={Example} />
<Route exact path="/states" component={States} />
</HashRouter>
</div>
)
}
}
ReactDOM.render(
<P5/>,
document.getElementById('reactapp'),
);
......@@ -3,6 +3,7 @@ module.exports = {
gettingStarted: './gettingStarted.jsx',
p2: './p2.jsx',
p4: './p4.jsx',
p5: './p5.jsx',
},
module: {
rules: [
......
Supports Markdown
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