Skip to content

Commit 301deba

Browse files
committed
Fix deprecation warning.
1 parent 7899c6b commit 301deba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/with-nextjs/pages/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Async from "react-async"
33
import DevTools from "react-async-devtools"
44
import fetch from "isomorphic-fetch"
55
import Link from "next/link"
6+
import { withRouter } from "next/router"
67

78
const loadUser = ({ userId = 1 }) =>
89
fetch(`https://reqres.in/api/users/${userId}`)
@@ -17,8 +18,8 @@ class Hello extends React.Component {
1718
}
1819

1920
render() {
20-
const { data, url } = this.props
21-
const { userId = 1 } = url.query
21+
const { data, router } = this.props
22+
const { userId = 1 } = router.query
2223
return (
2324
<>
2425
{process.browser && <DevTools />}
@@ -62,4 +63,4 @@ class Hello extends React.Component {
6263
}
6364
}
6465

65-
export default Hello
66+
export default withRouter(Hello)

0 commit comments

Comments
 (0)