Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,17 @@
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>React Router Basic Nav</title>
</head>
<body>
<noscript>
Expand Down
4 changes: 4 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React from 'react';
import './App.css';
import { Route } from "react-router-dom"
import { Home, About, Contact, Navigation } from './components';

const App = () => (
<div>
<Navigation />
<Route exact path="/" component={Home} />
<Route path="/about" component={About} />
<Route path="/contact" component={Contact} />
</div>
);

Expand Down
4 changes: 2 additions & 2 deletions src/components/Contact.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import React from "react";

const Contact = () => <h1>Contact</h1>;
const Contact = () => <h1>Contact Us</h1>;

export default Contact;
9 changes: 5 additions & 4 deletions src/components/Navigation.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from 'react';
import React from "react";
import { Link } from "react-router-dom";

const Navigation = () => {
return (
<div>
<div className="App">
<h1>React Router Mini</h1>
<div>
<a href="">Home</a>
<Link to="/">Home</Link>
</div>
<div>
<a href="">About</a>
<Link to="/about">About</Link>
</div>
<div>
<a href="">Contact</a>
<Link to="/contact">Contact</Link>
</div>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import { BrowserRouter as Router} from "react-router-dom"
import App from './App';
import 'bootstrap/dist/css/bootstrap.css';

ReactDOM.render(<App />, document.getElementById('root'));
ReactDOM.render(
<Router>
<App />
</Router>,
document.getElementById('root'));