Skip to content

Commit d67e4ab

Browse files
committed
Fixed setSharedState().
1 parent 94c2f2c commit d67e4ab

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# react-hooks-shared-state
2+
[![npm version](https://badge.fury.io/js/react-hooks-shared-state.svg)](https://www.npmjs.com/package/react-hooks-shared-state)
3+
24
A global state for React with Hooks API.
35

46
## Installation
@@ -36,15 +38,21 @@ sharedState.useState()
3638
```
3739
`useSharedState` and `sharedState.useState` are the same one.
3840

41+
### setSharedState(state)
42+
#### Parameter `state`
43+
Type: `any`
44+
Required: `required`
45+
Assign a new state.
46+
3947
### useSharedState(path, initialState)
40-
### Parameter `path`
48+
#### Parameter `path`
4149
Type: `string`
4250
Required: `optional`
4351
The object path of the state.
4452
When the path is null it will return the state(root).
4553
If you just want to use a part of state in the component, pass the object path.
4654

47-
### Parameter `initialState`
55+
#### Parameter `initialState`
4856
Type: `any`
4957
Required: `optional`
5058
The initial state.

example/dist/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)