47ng / 47ng/nuqs

react-router HashRouter support?

Open
#810 10 comments 4 reactions 0 assignees View on GitHub
adapters/react-router feature
Dominant language
TypeScript
Stars
10.8k
Forks
294
Avg merge
1d 16h
Merged PRs (30d)
21

Description

## Context

What's your version of `nuqs`?

```
-> https://pkg.pr.new/nuqs@807
```

What framework are you using?

- ✅ React Router

Which version of your framework are you using?

```
-> 7.0.2
```

## Description

For some reason, we can't use BrowserRouter in RR7, only HashRouter allowed. But useQueryState always append the whole hash part.

Expect:
```
http://localhost:5173/#/form

http://localhost:5173/#/form?keyword=kw

http://localhost:5173/#/form?keyword=kw1

http://localhost:5173/#/form?keyword=kw12

http://localhost:5173/#/form?keyword=kw123
```

Actual:
```
http://localhost:5173/#/form

http://localhost:5173/#/form?keyword=kw#/form

http://localhost:5173/#/form?keyword=kw1#/form?keyword=kw#/form

http://localhost:5173/#/form?keyword=kw12#/form?keyword=kw1#/form?keyword=kw#/form

http://localhost:5173/#/form?keyword=kw123#/form?keyword=kw12#/form?keyword=kw1#/form?keyword=kw#/form
```

## Reproduction

https://github.com/Jungzl/react-router-nuqs-hash-issue
1. go to '/form'
2. type something, press Enter
3. see url

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.