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 } })
@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.