Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vclemenzi/react-qstate
react-qstate: A react hook that allows the state to be saved in the URL
https://github.com/vclemenzi/react-qstate
hooks npm query react state
Last synced: about 3 hours ago
JSON representation
react-qstate: A react hook that allows the state to be saved in the URL
- Host: GitHub
- URL: https://github.com/vclemenzi/react-qstate
- Owner: vclemenzi
- License: mit
- Created: 2023-09-12T15:24:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-24T06:33:57.000Z (about 1 year ago)
- Last Synced: 2024-05-13T14:41:40.224Z (6 months ago)
- Topics: hooks, npm, query, react, state
- Language: TypeScript
- Homepage:
- Size: 98.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React Query State
react-qstate is a simple library that allows states to be saved in url parameters. The benefits can be various:- Have the exactly same UI
- A user can share the link on social and whoever clicks on it will have the same ui
- Can be saved as a bookmark and will bring back to the same UI
- You can use the "back" button to go back through the states
- It can help search engine optimization
- and more...## Installation
You can install it with your favorite package manger```bash
npm install react-qstate
``````bash
pnpm add react-qstate
``````bash
yarn add react-qstate
``````bash
bun add react-qstate
```## Usage
Its use is very simple and familiar with the existing `useState` hook```js
import { useQueryState } from "react-qstate";function App() {
const [count, setCount] = useQueryState("counter", 0);return (
You clicked {count} times
setCount(count + 1)}>Click me
);
}
```