Skip to content

Commit b142389

Browse files
committed
updates project
1 parent e19974f commit b142389

5 files changed

Lines changed: 24 additions & 28 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
Topics:
44

55
* Single Page Applications
6+
* React Router V4 (react-router-dom)
67
* Routing, declarative component based routing
7-
* Browser vs Hash History
88
* Path and Component
99

1010
## Project Description
1111

1212
* A starter pack project for all things React Router. Learn to set up a basic routing system within an application. Use this application to help guide your learning over the next couple of days.
13+
* **Note** that this project has already been boilerplated for you. There is no need to run any installation steps beyond `yarn install`.
1314

1415
### Initialize Project
1516

@@ -19,10 +20,10 @@ Topics:
1920
### Steps for implementing React Router
2021

2122
* You'll notice we've already installed react-router-dom for you.
22-
* `import` your Router as BrowserRouter inside your `index.js` file.
23+
* `import` your BrowserRouter as Router inside your `index.js` file.
2324
* Wrap your `<App />` component that you're passing to `ReactDOM.render()` with your new `Router` component.
2425
* open up your chrome `REACT DEV TOOLS` and notice your app is now all wrapped in `BrowserRouter`
25-
* inside the `REACT DEV TOOLS` expand `<BrowserRouter>` and highlight `<Router>` and notice that here is a `"history"` object on props.
26+
* inside the `REACT DEV TOOLS` expand `<BrowserRouter>` and highlight `<Router>` and notice that here is a `"history"` object on props and a `"match"` object on its state. These two objects are how all of our Router is going to work.
2627

2728
### Steps for "Declaring" your routes
2829

@@ -34,11 +35,9 @@ Topics:
3435

3536
### Steps for setting up your Navigation
3637

37-
* Inside of `Navigation.js` `import { Link } from 'react-router-dom'`
38-
* Delete `NavLink` and replace it with `<Link />`
39-
* Pro-tip: highlight NavLink and use `cmd/ctrl + d` to select them all at once.
40-
* Change the href on `<Link>` to `to` and specify the correct routes to navigate to.
41-
* Head over to your app and start navigating. You should be able to see your URLS changing their paths as you go.
38+
* Inside of `Navigation.js` `import { Link } from 'react-router-dom'`.
39+
* Declare the `to` as the href on `<Link>` and specify the correct routes for your app to navigate towards.
40+
* Head over to your app and start navigating. You should be able to see your URLS changing their paths as you go. Each path should display the proper component.
4241

4342
### Resources
4443

‎package.json‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
"private": true,
55
"dependencies": {
66
"bootstrap": "4.0.0-alpha.6",
7-
"react": "^15.6.1",
8-
"react-addons-css-transition-group": "^15.6.0",
9-
"react-addons-transition-group": "^15.6.0",
10-
"react-dom": "^15.6.1",
7+
"react": "^16.3.2",
8+
"react-dom": "^16.3.2",
119
"react-router-dom": "^4.1.2",
1210
"react-scripts": "1.0.10",
1311
"reactstrap": "^4.8.0"
@@ -18,4 +16,4 @@
1816
"test": "react-scripts test --env=jsdom",
1917
"eject": "react-scripts eject"
2018
}
21-
}
19+
}

‎src/App.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import './App.css';
3-
import Navigation from './components/Navigation';
4-
import { Home, About, Contact } from './components';
3+
import { Home, About, Contact, Navigation } from './components';
54

65
const App = () => (
76
<div>

‎src/components/Navigation.js‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import React from 'react';
2-
import { Nav, NavItem, NavLink } from 'reactstrap';
32

43
const Navigation = () => {
54
return (
65
<div>
7-
<Nav className="App">
6+
<div className="App">
87
<h1>React Router Mini</h1>
9-
<NavItem>
10-
<NavLink href="#">Home</NavLink>
11-
</NavItem>
12-
<NavItem>
13-
<NavLink href="#">About</NavLink>
14-
</NavItem>
15-
<NavItem>
16-
<NavLink href="#">Contact</NavLink>
17-
</NavItem>
18-
</Nav>
8+
<div>
9+
<a href="">Home</a>
10+
</div>
11+
<div>
12+
<a href="">About</a>
13+
</div>
14+
<div>
15+
<a href="">Contact</a>
16+
</div>
17+
</div>
1918
</div>
2019
);
2120
};

‎src/components/index.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Home from './Home';
22
import About from './About';
33
import Contact from './Contact';
4+
import Navigation from './Navigation';
45

5-
export { Home, About, Contact };
6+
export { Home, About, Contact, Navigation };

0 commit comments

Comments
 (0)