Add getInitialState as part of api utilities (#2729)

This commit is contained in:
Danilo Britto 2024-09-09 23:34:14 -05:00 committed by GitHub
parent 0a4f9d0f71
commit 5ebe8606d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View File

@ -37,8 +37,8 @@ createStore<T>()(stateCreatorFn: StateCreator<T, [], []>): StoreApi<T>
#### Returns
`createStore` returns a vanilla store that exposes API utilities, `setState`, `getState` and
`subscribe`.
`createStore` returns a vanilla store that exposes API utilities, `setState`, `getState`,
`getInitialState` and `subscribe`.
## Usage

View File

@ -40,10 +40,10 @@ createWithEqualityFn<T>()(stateCreatorFn: StateCreator<T, [], []>, equalityFn?:
#### Returns
`createWithEqualityFn` returns a React Hook with some API utilities, `setState`, `getState`, and
`subscribe`, attached like `create`. It lets you return data that is based on current state,
using a selector function, and lets you skip re-renders using an equality function. It should take
a selector function, and an equality function as arguments.
`createWithEqualityFn` returns a React Hook with API utilities attached, just like `create`. It
lets you return data that is based on current state, using a selector function, and lets you skip
re-renders using an equality function. It should take a selector function, and an equality function
as arguments.
### Updating state based on previous state

View File

@ -37,9 +37,9 @@ create<T>()(stateCreatorFn: StateCreator<T, [], []>): UseBoundStore<StoreApi<T>>
#### Returns
`create` returns a React Hook with some API utilities, `setState`, `getState`, and `subscribe`,
attached. It lets you return data that is based on current state, using a selector function. It
should take a selector function as its only argument.
`create` returns a React Hook with API utilities, `setState`, `getState`, `getInitialState` and
`subscribe`, attached. It lets you return data that is based on current state, using a selector
function. It should take a selector function as its only argument.
## Usage