- Notifications
You must be signed in to change notification settings - Fork165
Description
As said in readme:
These can be used separately from the main module and have an interface similar to useState. These hooksdon't support nesting, base path, route matching.
import { useBrowserLocation } from "wouter/use-browser-location" — allows to manipulate current location in the browser's address bar, a tiny wrapper around the History API.
import { useHashLocation } from "wouter/use-hash-location" — similarly, gets location from the hash part of the address, i.e. the string after a #.
import { memoryLocation } from "wouter/memory-location" — an in-memory location hook with history support, external navigation and immutable mode for testing. Note the module name because it is a high-order hook. See how memory location can be used intesting.
but according to my test, at least useHashLocation supports nested routing and base url.
constApp=()=>{return<Routerhook={useHashLocation}base="/app"><Switch><Routepath="/login"component={Login}/><Routepath="/register"component={Register}/><Routepath="/ucenter"nestcomponent={UCenter}/></Switch></Router>}