Skip to content

Commit f449a26

Browse files
committed
refactor: naming; new domain
1 parent 37967a3 commit f449a26

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
![npm](https://img.shields.io/npm/v/react-use-url-state?logo=npm)
44
![npm type definitions](https://img.shields.io/npm/types/react-use-url-state?logo=typescript)
55
![npm](https://img.shields.io/npm/dw/react-use-url-state)
6-
![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/react-use-url-state)
76
[![Known Vulnerabilities](https://snyk.io/test/npm/react-use-url-state/badge.svg)](https://snyk.io/test/react-use-url-state/axios)
87

98
Use URL to store a state in React.
@@ -27,7 +26,7 @@ npm i react-use-url-state zod
2726

2827
# Documentation
2928

30-
📝[Documentation and examples](https://react-use-url-state.vercel.app/)
29+
📝[Documentation and examples](https://react-use-url-state.wrigglework.com/)
3130

3231

3332
## Usage
@@ -36,7 +35,7 @@ npm i react-use-url-state zod
3635
3736
```tsx
3837
function MyComponent() {
39-
const { data, setState, setValue, isError, error } = useUrlState(
38+
const { data, setState, setValue, setValues, isError, error } = useUrlState(
4039
z.object({
4140
name: z.string(),
4241
age: z.coerce.number(),
@@ -65,8 +64,3 @@ function MyComponent() {
6564
</div>
6665
}
6766
```
68-
69-
## 🚧 TODO
70-
71-
* [ ] Add automatic tests
72-
* [ ] Add routers without polling for Next App/Page

apps/playground/components/StateChanger.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Button } from './Button';
99
import { StateView } from './StateView';
1010

1111
export function StateChanger() {
12-
const { data, setState, setValue, updateState, isError, error } = useUrlState(
12+
const { data, setState, setValue, setValues, isError, error } = useUrlState(
1313
z
1414
.object({
1515
name: z.string(),

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/wanjas/react-use-url-state",
88
"type": "git"
99
},
10-
"homepage": "https://react-use-url-state.vercel.app",
10+
"homepage": "https://react-use-url-state.wrigglework.com",
1111
"keywords": [
1212
"react",
1313
"hooks",

packages/core/src/handlers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function useHandlers<T extends DefaultSchema>(
2929
[push, stateRef],
3030
);
3131

32-
const updateState = useCallback<UrlStateMethods<T>['updateState']>(
32+
const setValues = useCallback<UrlStateMethods<T>['setValues']>(
3333
(state) => {
3434
if (typeof state === 'function') {
3535
state = state(stateRef.current.data);
@@ -55,7 +55,7 @@ export function useHandlers<T extends DefaultSchema>(
5555
);
5656

5757
return useMemo(
58-
() => ({ setState, setValue, updateState }),
59-
[setState, setValue, updateState],
58+
() => ({ setState, setValue, setValues }),
59+
[setState, setValue, setValues],
6060
);
6161
}

packages/core/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type UrlStateMethods<T extends DefaultSchema> = {
2323
key: K,
2424
value: UrlStateValue<T>[K],
2525
) => void;
26-
updateState: (
26+
setValues: (
2727
state:
2828
| Partial<UrlStateValue<T>>
2929
| ((state: UrlStateValue<T> | null) => Partial<UrlStateValue<T>>),

0 commit comments

Comments
 (0)