-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
103 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Page extends Component { | ||
render() { | ||
const props = this.props | ||
return ( | ||
<div className="page">{ props.name }</div> | ||
); | ||
} | ||
} | ||
|
||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { Component } from 'react'; | ||
|
||
import { BrowserRouter as Router, Route } from 'react-router-dom' | ||
|
||
import './App.css'; | ||
|
||
|
||
class App extends Component { | ||
render() { | ||
const { children } = this.props | ||
return ( | ||
<Router><div>{ | ||
React.Children.map(children, (child, i) => { | ||
console.log(child.props.exact, child.props.path) | ||
return ( | ||
<Route exact={ child.props.exact } path={ child.props.path } render={ () => child } /> | ||
) | ||
}) | ||
}</div></Router> | ||
); | ||
} | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './index.css'; | ||
import App from './App'; | ||
import Pages from './Pages'; | ||
import Page from './Page'; | ||
import registerServiceWorker from './registerServiceWorker'; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
ReactDOM.render( | ||
<Pages> | ||
<Page name="home" exact path="/" /> | ||
<Page name="page 2" path="/two" /> | ||
</Pages>, document.getElementById('root')); | ||
registerServiceWorker(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2965,6 +2965,16 @@ [email protected]: | |
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" | ||
|
||
history@^4.7.2: | ||
version "4.7.2" | ||
resolved "https://registry.yarnpkg.com/history/-/history-4.7.2.tgz#22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b" | ||
dependencies: | ||
invariant "^2.2.1" | ||
loose-envify "^1.2.0" | ||
resolve-pathname "^2.2.0" | ||
value-equal "^0.4.0" | ||
warning "^3.0.0" | ||
|
||
hmac-drbg@^1.0.0: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" | ||
|
@@ -2981,6 +2991,10 @@ [email protected]: | |
version "4.2.0" | ||
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" | ||
|
||
hoist-non-react-statics@^2.3.0: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0" | ||
|
||
home-or-tmp@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" | ||
|
@@ -3219,7 +3233,7 @@ interpret@^1.0.0: | |
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0" | ||
|
||
invariant@^2.2.2: | ||
invariant@^2.2.1, invariant@^2.2.2: | ||
version "2.2.2" | ||
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" | ||
dependencies: | ||
|
@@ -4019,7 +4033,7 @@ longest@^1.0.1: | |
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" | ||
|
||
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1: | ||
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1: | ||
version "1.3.1" | ||
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" | ||
dependencies: | ||
|
@@ -4609,7 +4623,7 @@ [email protected]: | |
version "0.1.7" | ||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" | ||
|
||
path-to-regexp@^1.0.1: | ||
path-to-regexp@^1.0.1, path-to-regexp@^1.7.0: | ||
version "1.7.0" | ||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" | ||
dependencies: | ||
|
@@ -5031,7 +5045,7 @@ promise@^7.1.1: | |
dependencies: | ||
asap "~2.0.3" | ||
|
||
prop-types@^15.6.0: | ||
prop-types@^15.5.4, prop-types@^15.6.0: | ||
version "15.6.0" | ||
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856" | ||
dependencies: | ||
|
@@ -5165,7 +5179,7 @@ react-dev-utils@^4.1.0: | |
strip-ansi "3.0.1" | ||
text-table "0.2.0" | ||
|
||
[email protected], "react-dom@^15 || ^16": | ||
"react-dom@^15 || ^16", react-dom@^16.0.0: | ||
version "16.0.0" | ||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.0.0.tgz#9cc3079c3dcd70d4c6e01b84aab2a7e34c303f58" | ||
dependencies: | ||
|
@@ -5187,6 +5201,29 @@ react-error-overlay@^2.0.2: | |
settle-promise "1.0.0" | ||
source-map "0.5.6" | ||
|
||
react-router-dom@^4.2.2: | ||
version "4.2.2" | ||
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.2.2.tgz#c8a81df3adc58bba8a76782e946cbd4eae649b8d" | ||
dependencies: | ||
history "^4.7.2" | ||
invariant "^2.2.2" | ||
loose-envify "^1.3.1" | ||
prop-types "^15.5.4" | ||
react-router "^4.2.0" | ||
warning "^3.0.0" | ||
|
||
react-router@^4.2.0: | ||
version "4.2.0" | ||
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.2.0.tgz#61f7b3e3770daeb24062dae3eedef1b054155986" | ||
dependencies: | ||
history "^4.7.2" | ||
hoist-non-react-statics "^2.3.0" | ||
invariant "^2.2.2" | ||
loose-envify "^1.3.1" | ||
path-to-regexp "^1.7.0" | ||
prop-types "^15.5.4" | ||
warning "^3.0.0" | ||
|
||
[email protected]: | ||
version "1.0.14" | ||
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-1.0.14.tgz#70fe76c9beb67b136b953e875bdfe4ad78d410d1" | ||
|
@@ -5229,7 +5266,7 @@ [email protected]: | |
optionalDependencies: | ||
fsevents "1.1.2" | ||
|
||
[email protected], "react@^15 || ^16": | ||
"react@^15 || ^16", react@^16.0.0: | ||
version "16.0.0" | ||
resolved "https://registry.yarnpkg.com/react/-/react-16.0.0.tgz#ce7df8f1941b036f02b2cca9dbd0cb1f0e855e2d" | ||
dependencies: | ||
|
@@ -5521,6 +5558,10 @@ resolve-from@^1.0.0: | |
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" | ||
|
||
resolve-pathname@^2.2.0: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.2.0.tgz#7e9ae21ed815fd63ab189adeee64dc831eefa879" | ||
|
||
[email protected]: | ||
version "1.1.7" | ||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" | ||
|
@@ -6331,6 +6372,10 @@ validate-npm-package-license@^3.0.1: | |
spdx-correct "~1.0.0" | ||
spdx-expression-parse "~1.0.0" | ||
|
||
value-equal@^0.4.0: | ||
version "0.4.0" | ||
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.4.0.tgz#c5bdd2f54ee093c04839d71ce2e4758a6890abc7" | ||
|
||
vary@~1.1.2: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" | ||
|
@@ -6359,6 +6404,12 @@ walker@~1.0.5: | |
dependencies: | ||
makeerror "1.0.x" | ||
|
||
warning@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c" | ||
dependencies: | ||
loose-envify "^1.0.0" | ||
|
||
watch@~0.10.0: | ||
version "0.10.0" | ||
resolved "https://registry.yarnpkg.com/watch/-/watch-0.10.0.tgz#77798b2da0f9910d595f1ace5b0c2258521f21dc" | ||
|