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
@timneutkens The repo's README states: Note: in order to programmatically change the route without triggering navigation and component-fetching, use props.url.push and props.url.replace within a component
Since url as a prop has been deprecated in Next v6, the file should be updated to indicate the correct way of performing a programatic url update with router.
It would be nice to also have an example that shows how to use the as parameter as well. In @tim's own words:
Basically push(href, as) href => page inside pages directory as => what’s displayed in the browser
https://github.com/zeit/next.js#routing is also including this bit Deprecated, use withRouter instead - Each top-level component receives a url property with the following API, which I believe is confusing.
It would be much better phrased if mentioned straight away the correct API with withRouter (or alternatively even passing down router as a prop from the page-level component) and mention that in previous versions url was available as a prop, but that's not the case anymore.
There is also a reference to using url.pushTo.
And url is also mentioned as a prop in the shallow routing section: You'll receive the updated pathname and the query via the url prop of the same page that's loaded, without losing state.
The text was updated successfully, but these errors were encountered:
Following #4950Fix#4716
I'm not sure to understand this part, though :
> Note: in order to programmatically change the route without triggering navigation and component-fetching, use `props.url.push` and `props.url.replace` within a component
Is there a difference between :
```jsx
export default () => <a onClick={() => Router.push('/about')}>About</a>
```
and
```jsx
export default withRouter(
() => <a onClick={() => props.router.push('/about')}>About</a>
)
```
?
lockbot
locked as resolved and limited conversation to collaborators
Aug 13, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
@timneutkens The repo's
README
states:Note: in order to programmatically change the route without triggering navigation and component-fetching, use props.url.push and props.url.replace within a component
Since
url
as a prop has been deprecated in Next v6, the file should be updated to indicate the correct way of performing a programatic url update withrouter
.It would be nice to also have an example that shows how to use the
as
parameter as well. In @tim's own words:https://github.com/zeit/next.js#routing is also including this bit
Deprecated, use withRouter instead - Each top-level component receives a url property with the following API
, which I believe is confusing.It would be much better phrased if mentioned straight away the correct API with
withRouter
(or alternatively even passing downrouter
as a prop from the page-level component) and mention that in previous versionsurl
was available as a prop, but that's not the case anymore.There is also a reference to using
url.pushTo
.And
url
is also mentioned as a prop in the shallow routing section:You'll receive the updated pathname and the query via the url prop of the same page that's loaded, without losing state.
The text was updated successfully, but these errors were encountered: