Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix(compat): upgrade React Router example lifecycles
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Apr 10, 2019
1 parent 5ff2f51 commit 2094213
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"react": "16.8.4",
"react-dom": "16.8.4",
"react-instantsearch-dom": "5.4.0",
"react-router-dom": "4.4.0"
"react-router-dom": "5.0.0"
},
"browserslist": [
">0.2%",
Expand Down
10 changes: 6 additions & 4 deletions examples/react-router/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ class App extends Component {
};
}

componentWillReceiveProps(props) {
// @TODO: derived state
if (props.location !== this.props.location) {
this.setState({ searchState: urlToSearchState(props.location) });
componentDidUpdate(prevProps) {
const previousLocation = qs.stringify(prevProps.location);
const currentLocation = qs.stringify(this.props.location);

if (previousLocation !== currentLocation) {
this.setState({ searchState: urlToSearchState(this.props.location) });
}
}

Expand Down
22 changes: 11 additions & 11 deletions examples/react-router/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4629,7 +4629,7 @@ hex-color-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==

history@4.9.0, history@^4.8.0-beta.0, history@^4.9.0:
history@4.9.0, history@^4.9.0:
version "4.9.0"
resolved "https://registry.yarnpkg.com/history/-/history-4.9.0.tgz#84587c2068039ead8af769e9d6a6860a14fa1bca"
integrity sha512-H2DkjCjXf0Op9OAr6nJ56fcRkTSNrUiv41vNJ6IswJjif6wlpZK0BTfFbi7qK9dXLSYZxkq5lBsj3vUjlYBYZA==
Expand Down Expand Up @@ -8429,23 +8429,23 @@ react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.4:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.4.tgz#90f336a68c3a29a096a3d648ab80e87ec61482a2"
integrity sha512-PVadd+WaUDOAciICm/J1waJaSvgq+4rHE/K70j0PFqKhkTBsPv/82UGQJNXAngz1fOQLLxI6z1sEDmJDQhCTAA==

react-router-dom@4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.4.0.tgz#fad67b46375f7081a76d1c92a83a92d28b5abc35"
integrity sha512-r4knbi8lanTGrwoUXFaWALrJZOAl3h9bdFUz4woHgEm7/bYcpBGfnYhPU82xjXrPeJyWF6OmIxpwXjxos30gOQ==
react-router-dom@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.0.0.tgz#542a9b86af269a37f0b87218c4c25ea8dcf0c073"
integrity sha512-wSpja5g9kh5dIteZT3tUoggjnsa+TPFHSMrpHXMpFsaHhQkm/JNVGh2jiF9Dkh4+duj4MKCkwO6H08u6inZYgQ==
dependencies:
"@babel/runtime" "^7.1.2"
history "^4.8.0-beta.0"
history "^4.9.0"
loose-envify "^1.3.1"
prop-types "^15.6.2"
react-router "^4.4.0"
react-router "5.0.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

react-router@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.4.0.tgz#e8b8b88329f564d4c48b7ee631b10310188c6888"
integrity sha512-qTGsOSF2b02zOsUfcnHjw7muI0Ejx+yA2e4P9qqzB2O+N3Icpca4epViXRgkBIvBjagXBtroxXqH0RJhYDMUbg==
react-router@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.0.0.tgz#349863f769ffc2fa10ee7331a4296e86bc12879d"
integrity sha512-6EQDakGdLG/it2x9EaCt9ZpEEPxnd0OCLBHQ1AcITAAx7nCnyvnzf76jKWG1s2/oJ7SSviUgfWHofdYljFexsA==
dependencies:
"@babel/runtime" "^7.1.2"
create-react-context "^0.2.2"
Expand Down

0 comments on commit 2094213

Please sign in to comment.