Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash router nesting and base #501

Open
bonboru93 opened this issue Dec 22, 2024 · 0 comments
Open

hash router nesting and base #501

bonboru93 opened this issue Dec 22, 2024 · 0 comments

Comments

@bonboru93
Copy link

bonboru93 commented Dec 22, 2024

As said in readme:

These can be used separately from the main module and have an interface similar to useState. These hooks don'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 in testing.

but according to my test, at least useHashLocation supports nested routing and base url.

const App = () => {
  return <Router hook={useHashLocation} base="/app">
    <Switch>
      <Route path="/login" component={Login} />
      <Route path="/register" component={Register} />
      <Route path="/ucenter" nest component={UCenter} />
    </Switch>
  </Router>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant