Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

hash router nesting and base #501

Open
@bonboru93

Description

@bonboru93

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>}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp