react-hooks-global-state
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -5,2 +5,6 @@ # Change Log | ||
## [0.9.0] - 2019-03-18 | ||
### Changed | ||
- Better typings for optional initialState | ||
## [0.8.0] - 2019-03-16 | ||
@@ -7,0 +11,0 @@ ### Changed |
@@ -18,2 +18,4 @@ import * as React from 'react'; | ||
export type ReduxLikeReducer<S, A> = (state: S | undefined, action: A | { type: undefined }) => S; | ||
export type Dispatch<A> = (action: A) => A; | ||
@@ -48,3 +50,9 @@ | ||
export type CreateReduxLikeStore = <S, A>( | ||
reducer: ReduxLikeReducer<S, A>, | ||
initialState: S | undefined, | ||
enhancer?: Enhancer<S, A> | AnyEnhancer, | ||
) => Store<S, A>; | ||
export const createGlobalState: CreateGlobalState; | ||
export const createStore: CreateStore; | ||
export const createStore: CreateStore | CreateReduxLikeStore; |
{ | ||
"name": "react-hooks-global-state", | ||
"description": "Simple global state for React with Hooks API", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"author": "Daishi Kato", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -76,3 +76,3 @@ # react-hooks-global-state | ||
}; | ||
const initialState = { counter: 0 }; // initialState is not optional. | ||
const initialState = { counter: 0 }; | ||
const { GlobalStateProvider, dispatch, useGlobalState } = createStore(reducer, initialState); | ||
@@ -140,2 +140,3 @@ | ||
- [Ideas](https://github.com/dai-shi/react-hooks-global-state/wiki/Ideas) | ||
- [Persistence](https://github.com/dai-shi/react-hooks-global-state/wiki/Persistence) | ||
- [Optional initialState](https://github.com/dai-shi/react-hooks-global-state/wiki/Optional-initialState) |
@@ -18,2 +18,4 @@ import * as React from 'react'; | ||
export type ReduxLikeReducer<S, A> = (state: S | undefined, action: A | { type: undefined }) => S; | ||
export type Dispatch<A> = (action: A) => A; | ||
@@ -48,3 +50,9 @@ | ||
export type CreateReduxLikeStore = <S, A>( | ||
reducer: ReduxLikeReducer<S, A>, | ||
initialState: S | undefined, | ||
enhancer?: Enhancer<S, A> | AnyEnhancer, | ||
) => Store<S, A>; | ||
export const createGlobalState: CreateGlobalState; | ||
export const createStore: CreateStore; | ||
export const createStore: CreateStore | CreateReduxLikeStore; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30121
496
141