Skip to content

Commit

Permalink
#Router: React Router v4 support added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danjavia committed Apr 17, 2017
1 parent 45d6463 commit ea284c9
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 21 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"react-apollo": "^0.11.1",
"react-dom": "^15.4.1",
"react-router": "^3.0.2",
"react-router-dom": "^4.1.1",
"react-tap-event-plugin": "^2.0.1",
"react-test-renderer": "^15.4.2"
},
Expand Down
7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
**/
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
// import { Router, browserHistory } from 'react-router';
import { BrowserRouter as Router } from 'react-router-dom';
import ApolloClient, { createNetworkInterface } from 'apollo-client';
import { ApolloProvider } from 'react-apollo';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
Expand All @@ -28,7 +29,9 @@ const client = new ApolloClient({
ReactDOM.render(
<ApolloProvider client={client}>
<MuiThemeProvider>
<Router history={browserHistory} routes={Routes} />
<Router>
<Routes />
</Router>
</MuiThemeProvider>
</ApolloProvider>,
document.getElementById('root')
Expand Down
12 changes: 6 additions & 6 deletions src/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
* External libraries
**/
import React from 'react';
import { IndexRoute, Route } from 'react-router';
import { Route } from 'react-router-dom';

/**
* Internal Resources
**/
import App from '../components/App/App';
// import App from '../components/App/App';
import HomePage from '../pages/HomePage/HomePage';
import NotFound from '../pages/NotFound/NotFound';

/**
* Router class definition.
**/
export default (
<Route path="/" component={App}>
<IndexRoute component={HomePage} />
export default () => (
<div className="container">
<Route exact path="/" component={HomePage} />
<Route path="*" component={NotFound} />
</Route>
</div>
);
71 changes: 58 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ anymatch@^1.3.0:
arrify "^1.0.0"
micromatch "^2.1.5"

apollo-client@^1.0.0-rc.7:
version "1.0.0-rc.8"
resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-1.0.0-rc.8.tgz#30105eb33f59ecab63f493177416d720ba0a8fd9"
apollo-client@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-1.0.3.tgz#668dc4f17e0f516488a0bad99141d6d237499927"
dependencies:
graphql "^0.9.1"
graphql "^0.9.3"
graphql-anywhere "^3.0.1"
graphql-tag "^2.0.0"
redux "^3.4.0"
Expand Down Expand Up @@ -2242,7 +2242,7 @@ fb-watchman@^1.8.0, fb-watchman@^1.9.0:
dependencies:
bser "1.0.2"

fbjs@^0.8.1, fbjs@^0.8.4, fbjs@^0.8.6:
fbjs@^0.8.1, fbjs@^0.8.4, fbjs@^0.8.6, fbjs@^0.8.9:
version "0.8.9"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.9.tgz#180247fbd347dcc9004517b904f865400a0c8f14"
dependencies:
Expand Down Expand Up @@ -2549,9 +2549,9 @@ graphql-tag@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.0.0.tgz#f3efe3b4d64f33bfe8479ae06a461c9d72f2a6fe"

graphql@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.9.1.tgz#f4d154cbec054d4a5d3b1be95f23435c09aa86c8"
graphql@^0.9.3:
version "0.9.3"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.9.3.tgz#71fc0fa331bffb9c20678485861cfb370803118e"
dependencies:
iterall "1.0.3"

Expand Down Expand Up @@ -2626,6 +2626,16 @@ history@^3.0.0:
query-string "^4.2.2"
warning "^3.0.0"

history@^4.5.1, history@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/history/-/history-4.6.1.tgz#911cf8eb65728555a94f2b12780a0c531a14d2fd"
dependencies:
invariant "^2.2.1"
loose-envify "^1.2.0"
resolve-pathname "^2.0.0"
value-equal "^0.2.0"
warning "^3.0.0"

[email protected]:
version "2.16.3"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"
Expand Down Expand Up @@ -2837,7 +2847,7 @@ interpret@^0.6.4:
version "0.6.6"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-0.6.6.tgz#fecd7a18e7ce5ca6abfb953e1f86213a49f1625b"

invariant@^2.2.0, invariant@^2.2.1:
invariant@^2.2.0, 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:
Expand Down Expand Up @@ -3700,7 +3710,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.2.0:
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:
Expand Down Expand Up @@ -4317,7 +4327,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.5.3:
version "1.7.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d"
dependencies:
Expand Down Expand Up @@ -4711,6 +4721,12 @@ [email protected], promise@^7.1.1:
dependencies:
asap "~2.0.3"

prop-types@^15.5.4:
version "15.5.8"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394"
dependencies:
fbjs "^0.8.9"

proxy-addr@~1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-1.1.3.tgz#dc97502f5722e888467b3fa2297a7b1ff47df074"
Expand Down Expand Up @@ -4855,6 +4871,15 @@ react-event-listener@^0.4.0:
react-addons-shallow-compare "^15.4.2"
warning "^3.0.0"

react-router-dom@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.1.1.tgz#3021ade1f2c160af97cf94e25594c5f294583025"
dependencies:
history "^4.5.1"
loose-envify "^1.3.1"
prop-types "^15.5.4"
react-router "^4.1.1"

react-router@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.0.2.tgz#5a19156678810e01d81901f9c0fef63284b8a514"
Expand All @@ -4865,6 +4890,18 @@ react-router@^3.0.2:
loose-envify "^1.2.0"
warning "^3.0.0"

react-router@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.1.1.tgz#d448f3b7c1b429a6fbb03395099949c606b1fe95"
dependencies:
history "^4.6.0"
hoist-non-react-statics "^1.2.0"
invariant "^2.2.2"
loose-envify "^1.3.1"
path-to-regexp "^1.5.3"
prop-types "^15.5.4"
warning "^3.0.0"

[email protected]:
version "0.8.4"
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-0.8.4.tgz#6c41a0ffb76985359fec3cf641ae7e788d905883"
Expand Down Expand Up @@ -5188,6 +5225,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"

[email protected], [email protected]:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
Expand Down Expand Up @@ -5883,6 +5924,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"
Expand Down Expand Up @@ -6023,11 +6068,11 @@ whatwg-encoding@^1.0.1:
dependencies:
iconv-lite "0.4.13"

[email protected], whatwg-fetch@>=0.10.0:
[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-1.0.0.tgz#01c2ac4df40e236aaa18480e3be74bd5c8eb798e"

whatwg-fetch@^2.0.0:
whatwg-fetch@>=0.10.0, whatwg-fetch@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.2.tgz#fe294d1d89e36c5be8b3195057f2e4bc74fc980e"

Expand Down

0 comments on commit ea284c9

Please sign in to comment.