You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add withRoute HOC
Rebased (squashed)
- removed routerToProps
- updated hoist-non-react-statics
- improved propTypes
* Expose the whole Router instead of the route.
* Make the example simple.
* Update examples and the readme.
* Add a test case.
[](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/using-with-router)
2
+
# Example app utilizing `withRouter` utility for routing
3
+
4
+
## How to use
5
+
6
+
Download the example [or clone the repo](https://github.com/zeit/next.js):
7
+
8
+
```bash
9
+
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/using-with-router
10
+
cd using-with-router
11
+
```
12
+
13
+
Install it and run:
14
+
15
+
```bash
16
+
npm install
17
+
npm run dev
18
+
```
19
+
20
+
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
21
+
22
+
```bash
23
+
now
24
+
```
25
+
26
+
## The idea behind the example
27
+
28
+
Sometimes, we want to use the `router` inside component of our app without using the singleton `next/router` API.
29
+
30
+
You can do that by creating a React Higher Order Component with the help of the `withRouter` utility.
0 commit comments