diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-18 18:02:12 +0100 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-18 18:02:12 +0100 |
commit | 2cc74d254004d2551c19c778ce7f7d2070a9b45b (patch) | |
tree | ce9ab49cfd9ada3af8e83533c0b82059730cdd14 | |
parent | Clean front-end files (diff) | |
download | seven-wonders-2cc74d254004d2551c19c778ce7f7d2070a9b45b.tar.gz seven-wonders-2cc74d254004d2551c19c778ce7f7d2070a9b45b.tar.bz2 seven-wonders-2cc74d254004d2551c19c778ce7f7d2070a9b45b.zip |
Add react-router with small example
-rw-r--r-- | src/main/js/package.json | 1 | ||||
-rw-r--r-- | src/main/js/src/containers/App/index.js | 7 | ||||
-rw-r--r-- | src/main/js/src/index.js | 14 | ||||
-rw-r--r-- | src/main/js/yarn.lock | 72 |
4 files changed, 68 insertions, 26 deletions
diff --git a/src/main/js/package.json b/src/main/js/package.json index 94282e0e..46281613 100644 --- a/src/main/js/package.json +++ b/src/main/js/package.json @@ -9,6 +9,7 @@ "react": "^15.4.1", "react-dom": "^15.4.1", "react-redux": "^5.0.1", + "react-router": "4.0.0-alpha.6", "redux": "^3.6.0" }, "scripts": { diff --git a/src/main/js/src/containers/App/index.js b/src/main/js/src/containers/App/index.js index 15740d93..507c01ae 100644 --- a/src/main/js/src/containers/App/index.js +++ b/src/main/js/src/containers/App/index.js @@ -1,5 +1,8 @@ import React from 'react' - +import { Link } from 'react-router' export default () => { - return <h1>Hello World</h1> + return <div> + <h1>Hello World</h1> + <Link to="/404">Go to 404</Link> + </div> }
\ No newline at end of file diff --git a/src/main/js/src/index.js b/src/main/js/src/index.js index 93feb5d3..31ddded9 100644 --- a/src/main/js/src/index.js +++ b/src/main/js/src/index.js @@ -1,8 +1,8 @@ import React from 'react' import ReactDOM from 'react-dom' +import { BrowserRouter, Match, Miss } from 'react-router' import { Provider } from 'react-redux' import configureStore from './store' -import './index.css' const initialState = {} const store = configureStore(initialState) @@ -11,11 +11,21 @@ if (window.devToolsExtension) { window.devToolsExtension.updateStore(store) } +import './index.css' import App from './containers/App' +const NoMatch = () => { + return <h1>No Match</h1> +} + ReactDOM.render( <Provider store={store}> - <App /> + <BrowserRouter> + <div className="app"> + <Match exactly pattern="/" component={App} /> + <Miss component={NoMatch} /> + </div> + </BrowserRouter> </Provider>, document.getElementById('root') ); diff --git a/src/main/js/yarn.lock b/src/main/js/yarn.lock index 4963b2f5..c3f32431 100644 --- a/src/main/js/yarn.lock +++ b/src/main/js/yarn.lock @@ -1925,7 +1925,7 @@ events@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" -eventsource@^0.1.3, eventsource@~0.1.6: +eventsource@^0.1.3: version "0.1.6" resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-0.1.6.tgz#0acede849ed7dd1ccc32c811bb11b944d4f29232" dependencies: @@ -2020,12 +2020,6 @@ faye-websocket@^0.10.0: dependencies: websocket-driver ">=0.5.1" -faye-websocket@~0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.0.tgz#d9ccf0e789e7db725d74bc4877d23aa42972ac50" - dependencies: - websocket-driver ">=0.5.1" - faye-websocket@~0.7.3: version "0.7.3" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.7.3.tgz#cc4074c7f4a4dfd03af54dd65c354b135132ce11" @@ -2357,6 +2351,16 @@ he@1.1.x: version "1.1.0" resolved "https://registry.yarnpkg.com/he/-/he-1.1.0.tgz#29319d49beec13a9b1f3c4f9b2a6dde4859bb2a7" +history@^4.3.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/history/-/history-4.5.0.tgz#7313388109333bf5796fff7407cee1850e8c5061" + dependencies: + invariant "^2.2.1" + loose-envify "^1.2.0" + resolve-pathname "^2.0.0" + value-equal "^0.2.0" + warning "^3.0.0" + hoek@2.x.x: version "2.16.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" @@ -2532,7 +2536,7 @@ interpret@^0.6.4: version "0.6.6" resolved "https://registry.yarnpkg.com/interpret/-/interpret-0.6.6.tgz#fecd7a18e7ce5ca6abfb953e1f86213a49f1625b" -invariant@^2.0.0, invariant@^2.2.0: +invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -3260,7 +3264,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.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.0.tgz#6b26248c42f6d4fa4b0d8542f78edfcde35642a8" dependencies: @@ -3730,6 +3734,12 @@ path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" +path-to-regexp@^1.5.3: + version "1.7.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" + dependencies: + isarray "0.0.1" + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -4123,7 +4133,7 @@ qs@6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.2.0.tgz#3b7848c03c2dece69a9522b0fae8c4126d745f3b" -query-string@^4.1.0: +query-string@^4.1.0, query-string@4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.2.3.tgz#9f27273d207a25a8ee4c7b8c74dcd45d556db822" dependencies: @@ -4162,6 +4172,12 @@ rc@~1.1.6: minimist "^1.2.0" strip-json-comments "~1.0.4" +react-broadcast@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/react-broadcast/-/react-broadcast-0.1.2.tgz#950de63578a2af399a396067a617af7402182330" + dependencies: + invariant "^2.2.1" + react-dev-utils@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-0.4.1.tgz#06385e3c15014d4dfa0a6134bfeeeb0700cc04dd" @@ -4192,6 +4208,15 @@ react-redux: lodash-es "^4.2.0" loose-envify "^1.1.0" +react-router@4.0.0-alpha.6: + version "4.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.0.0-alpha.6.tgz#239fcf9a6ba7997021022c9b51d72d370f7b6bf4" + dependencies: + history "^4.3.0" + path-to-regexp "^1.5.3" + query-string "4.2.3" + react-broadcast "^0.1.2" + react-scripts@0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-0.8.3.tgz#96c7d45f57eca5f00415c53fda27ef9a36566580" @@ -4470,6 +4495,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.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.0.2.tgz#e55c016eb2e9df1de98e85002282bfb38c630436" + resolve@^1.1.6, resolve@1.1.7, resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -4626,17 +4655,6 @@ sockjs-client@^1.0.3, sockjs-client@1.0.3: json3 "^3.3.2" url-parse "^1.0.1" -sockjs-client@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.1.1.tgz#284843e9a9784d7c474b1571b3240fca9dda4bb0" - dependencies: - debug "^2.2.0" - eventsource "~0.1.6" - faye-websocket "~0.11.0" - inherits "^2.0.1" - json3 "^3.3.2" - url-parse "^1.1.1" - sockjs@^0.3.15: version "0.3.18" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.18.tgz#d9b289316ca7df77595ef299e075f0f937eb4207" @@ -4998,7 +5016,7 @@ url-loader@0.5.7: loader-utils "0.2.x" mime "1.2.x" -url-parse@^1.0.1, url-parse@^1.1.1: +url-parse@^1.0.1: version "1.1.7" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.1.7.tgz#025cff999653a459ab34232147d89514cc87d74a" dependencies: @@ -5062,6 +5080,10 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" +value-equal@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.0.tgz#4f41c60a3fc011139a2ec3d3340a8998ae8b69c0" + vary@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.0.tgz#e1e5affbbd16ae768dd2674394b9ad3022653140" @@ -5088,6 +5110,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" |