Router: documentation for navigate "option - state" is wrong

Created on 5 Nov 2019  路  5Comments  路  Source: reach/router

the value is passed incorrectly navigate("/todos", { newId: id }), should be changed to navigate("/todos", { state: { newId: id } })

there is disagreement about the name of the value passed into location state. the code that calls navigate names it "newId", the the code that uses it thinks it is named "id". I assume the value should be named "id"

so the caller should be changed to navigate("/todos", { state: { id } })

good first issue

All 5 comments

@SamMaxwell thanks for the report! Would you be interested in contributing this fix?

I bumped into the same issue when implementing navigate() based on the doc site on https://reach.tech/router/api/navigate.

In addition to newId / id mismatch, the doc site also lacks state property in the options object in the code example

navigate("/todos", { newId: id })

I assume it should be:

navigate("/todos", { state: { newId: id } })

Both issues seem to have been fixed for a while in the source: https://github.com/reach/router/blob/master/website/src/markdown/api/navigate.md

@blainekasten perhaps the latest doc needs to be deployed? The current one on https://reach.tech/router does indeed say v1.1.0 in the page header which is a fairly old version.

Word. I'll get a new version out soon and talk to Ryan about getting the site updated. Thanks for the advice 馃憤

I think this issue is fixed and can be closed? https://reach.tech/router/api/navigate

Isn't this issue a duplicate of https://github.com/reach/router/issues/96 ??

@blainekasten has fixed and marked the #96 issue as done at Feb 14th. This issue was reported before. I think this is a duplicate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artoodeeto picture artoodeeto  路  4Comments

kbrgl picture kbrgl  路  4Comments

ryanflorence picture ryanflorence  路  4Comments

thupi picture thupi  路  4Comments

jsonmaur picture jsonmaur  路  4Comments