react-hooks-global-state
Advanced tools
Comparing version 0.7.0 to 0.8.0
# Change Log | ||
## [Unreleased] | ||
## [0.8.0] - 2019-03-16 | ||
### Changed | ||
- Experimental support for eliminating initialState | ||
- Copied devtools.d.ts into the dist folder | ||
## [0.7.0] - 2019-02-11 | ||
### Changed | ||
- Fixed type definition of CreateGlobalState | ||
@@ -6,0 +13,0 @@ - Eliminated React warning for using unstable_observedBits |
@@ -146,2 +146,5 @@ "use strict"; | ||
var createStore = function createStore(reducer, initialState, enhancer) { | ||
if (!initialState) initialState = reducer(undefined, { | ||
type: undefined | ||
}); | ||
if (enhancer) return enhancer(createStore)(reducer, initialState); | ||
@@ -148,0 +151,0 @@ |
{ | ||
"name": "react-hooks-global-state", | ||
"description": "Simple global state for React with Hooks API", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"author": "Daishi Kato", | ||
@@ -18,3 +18,3 @@ "repository": { | ||
"scripts": { | ||
"compile": "babel src -d dist", | ||
"compile": "babel src -d dist && cp src/*.d.ts dist", | ||
"test": "npm run eslint && npm run tsc-test && npm run jest", | ||
@@ -50,13 +50,13 @@ "eslint": "eslint --ext .js,.ts,.tsx --ignore-pattern dist .", | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.2.2", | ||
"@babel/preset-env": "^7.3.1", | ||
"@babel/core": "^7.3.4", | ||
"@babel/preset-env": "^7.3.4", | ||
"@babel/preset-react": "^7.0.0", | ||
"@types/react": "^16.8.2", | ||
"@types/react-dom": "^16.8.0", | ||
"@types/redux-logger": "^3.0.6", | ||
"@typescript-eslint/eslint-plugin": "^1.2.0", | ||
"@types/react": "^16.8.8", | ||
"@types/react-dom": "^16.8.2", | ||
"@types/redux-logger": "^3.0.7", | ||
"@typescript-eslint/eslint-plugin": "^1.4.2", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-eslint": "^10.0.1", | ||
"babel-loader": "^8.0.5", | ||
"eslint": "^5.13.0", | ||
"eslint": "^5.15.2", | ||
"eslint-config-airbnb": "^17.1.0", | ||
@@ -67,7 +67,7 @@ "eslint-plugin-import": "^2.16.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"immer": "^2.0.0", | ||
"jest": "^24.1.0", | ||
"immer": "^2.1.3", | ||
"jest": "^24.5.0", | ||
"react": "^16.8.1", | ||
"react-dom": "^16.8.1", | ||
"react-testing-library": "^5.5.3", | ||
"react-dom": "^16.8.4", | ||
"react-testing-library": "^6.0.0", | ||
"redux": "^4.0.1", | ||
@@ -77,6 +77,6 @@ "redux-logger": "^3.0.6", | ||
"ts-loader": "^5.3.3", | ||
"typescript": "^3.3.1", | ||
"webpack": "^4.29.2", | ||
"webpack-cli": "^3.2.3", | ||
"webpack-dev-server": "^3.1.14" | ||
"typescript": "^3.3.3333", | ||
"webpack": "^4.29.6", | ||
"webpack-cli": "^3.3.0", | ||
"webpack-dev-server": "^3.2.1" | ||
}, | ||
@@ -83,0 +83,0 @@ "peerDependencies": { |
@@ -1,3 +0,2 @@ | ||
react-hooks-global-state | ||
======================== | ||
# react-hooks-global-state | ||
@@ -10,4 +9,3 @@ [![Build Status](https://travis-ci.com/dai-shi/react-hooks-global-state.svg?branch=master)](https://travis-ci.com/dai-shi/react-hooks-global-state) | ||
Introduction | ||
------------ | ||
## Introduction | ||
@@ -30,4 +28,3 @@ If you ever try to implement a global state with Context and Hooks, | ||
Install | ||
------- | ||
## Install | ||
@@ -38,4 +35,3 @@ ```bash | ||
Usage | ||
----- | ||
## Usage | ||
@@ -105,4 +101,3 @@ ### setState style | ||
Examples | ||
-------- | ||
## Examples | ||
@@ -133,4 +128,3 @@ The [examples](examples) folder contains working examples. | ||
Limitations | ||
----------- | ||
## Limitations | ||
@@ -141,4 +135,3 @@ - Due to the implementation relying on `observedBits` in the Context API, | ||
Blogs | ||
----- | ||
## Blogs | ||
@@ -150,5 +143,4 @@ - [TypeScript-aware React hooks for global state](https://medium.com/@dai_shi/typescript-aware-react-hooks-for-global-state-b6e2dfc0e9a7) | ||
Community Wiki | ||
-------------- | ||
## Community Wiki | ||
- [Ideas](https://github.com/dai-shi/react-hooks-global-state/wiki/Ideas) |
@@ -35,3 +35,3 @@ import * as React from 'react'; | ||
export type CreateGlobalState = <S extends {}>(initialState: S) => { | ||
export type CreateGlobalState = <S>(initialState: S) => { | ||
GlobalStateProvider: React.ComponentType<GlobalStateProviderProps>; | ||
@@ -42,3 +42,3 @@ useGlobalState: UseGlobalState<S>; | ||
export type CreateStore = <S extends {}, A extends {}>( | ||
export type CreateStore = <S, A>( | ||
reducer: Reducer<S, A>, | ||
@@ -45,0 +45,0 @@ initialState: S, |
@@ -114,2 +114,3 @@ import { | ||
export const createStore = (reducer, initialState, enhancer) => { | ||
if (!initialState) initialState = reducer(undefined, { type: undefined }); | ||
if (enhancer) return enhancer(createStore)(reducer, initialState); | ||
@@ -116,0 +117,0 @@ const { |
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
29368
12
484
140