Skip to content

Interface: RouteStateOptions ​

Defined in: router/types.ts:26

The options of useRouteState. The defaults of source, history, clearOnDefault and mode come from the router options of the instance.

Properties ​

PropertyTypeDefault valueDescriptionDefined in
clearOnDefault?booleantrueRemoves the param instead of writing a value equal to the parser default.router/types.ts:50
history?HistoryMode'replace'How a write navigates. Writes made in the same tick become one navigation, which is pushed when any of them asks for 'push'.router/types.ts:48
keystringundefinedNames the state, and the param unless urlKey is given.router/types.ts:28
missing?unknownthe missing of the instanceWhat the ref reads without a value or a default, and what removes the param when written. A key set to undefined means undefined, and a key left out takes the one of the instance.router/types.ts:37
mode?StateMode'optimistic'With 'optimistic', a write reads back at once and the URL takes over when the navigation lands, so a navigation a guard cancels returns the ref to what the URL holds. With 'source', every read goes to the current route.router/types.ts:58
parser?ParserInputparseAsStringTurns the param into a value and determines the type of the ref.router/types.ts:30
source?RouteStateSource'query'Which part of the route the state reads.router/types.ts:41
urlKey?stringthe value of keyThe name of the param in the URL.router/types.ts:39

Released under the MIT License.