@@ -6,7 +6,7 @@ let router = null
6
6
const SingletonRouter = { }
7
7
8
8
// Create public properties and methods of the router in the SingletonRouter
9
- const propertyFields = [ 'route ' , 'components ' , 'pathname ' , 'query' ]
9
+ const propertyFields = [ 'components ' , 'pathname ' , 'route ' , 'query' ]
10
10
const methodFields = [ 'push' , 'replace' , 'reload' , 'back' ]
11
11
12
12
propertyFields . forEach ( ( field ) => {
@@ -32,7 +32,7 @@ methodFields.forEach((field) => {
32
32
function throwIfNoRouter ( ) {
33
33
if ( ! router ) {
34
34
const message = 'No router instance found.\n' +
35
- 'If you are using "next/router" inside "getInitialProps", avoid it .\n'
35
+ 'You should only use "next/router" inside the client side of your app .\n'
36
36
throw new Error ( message )
37
37
}
38
38
}
@@ -52,17 +52,5 @@ export const createRouter = function (...args) {
52
52
return router
53
53
}
54
54
55
- // This helper is used to assign a router instance only when running the "cb"
56
- // This is useful for assigning a router instance when we do SSR.
57
- export const withRouter = function ( r , cb ) {
58
- const original = router
59
- router = r
60
- const result = cb ( )
61
-
62
- router = original
63
- return result
64
- }
65
-
66
- // Export the actual Router class, which is also use internally
67
- // You'll ever need to access this directly
55
+ // Export the actual Router class, which is usually used inside the server
68
56
export const Router = _Router
0 commit comments