Skip to content

Commit 062ccd0

Browse files
committed
Merge commit '0b150204decb9310a41712d3cb97bc47f0aab8fb'
2 parents 0fa7c78 + 0b15020 commit 062ccd0

File tree

7 files changed

+41
-4
lines changed

7 files changed

+41
-4
lines changed

dist/index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,16 @@ export declare function useState<S>(source: State<S>): State<S>;
429429
* or in effects) or it's children.
430430
*/
431431
export declare function useState<S>(source: SetInitialStateAction<S>): State<S>;
432+
/**
433+
* Alias to [useState](#usestate) which provides a workaround
434+
* for [React 20613 bug](https://github.com/facebook/react/issues/20613)
435+
*/
436+
export declare function useHookstate<S>(source: State<S>): State<S>;
437+
/**
438+
* Alias to [useState](#usestate) which provides a workaround
439+
* for [React 20613 bug](https://github.com/facebook/react/issues/20613)
440+
*/
441+
export declare function useHookstate<S>(source: SetInitialStateAction<S>): State<S>;
432442
/**
433443
* Allows to use a state without defining a functional react component.
434444
* It can be also used in class-based React components. It is also

dist/index.es.js

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

dist/index.es.js.map

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

dist/index.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hookstate/core",
3-
"version": "3.0.4",
3+
"version": "3.0.5",
44
"description": "The flexible, fast and extendable state management for React that is based on hooks and state usage tracking.",
55
"license": "MIT",
66
"author": {

src/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,26 @@ export function useState<S>(
497497
): State<S>;
498498
export function useState<S>(
499499
source: SetInitialStateAction<S> | State<S>
500+
): State<S> {
501+
return useHookstate(source as State<S>);
502+
}
503+
504+
/**
505+
* Alias to [useState](#usestate) which provides a workaround
506+
* for [React 20613 bug](https://github.com/facebook/react/issues/20613)
507+
*/
508+
export function useHookstate<S>(
509+
source: State<S>
510+
): State<S>;
511+
/**
512+
* Alias to [useState](#usestate) which provides a workaround
513+
* for [React 20613 bug](https://github.com/facebook/react/issues/20613)
514+
*/
515+
export function useHookstate<S>(
516+
source: SetInitialStateAction<S>
517+
): State<S>;
518+
export function useHookstate<S>(
519+
source: SetInitialStateAction<S> | State<S>
500520
): State<S> {
501521
const parentMethods = typeof source === 'object' && source !== null ?
502522
source[self] as StateMethodsImpl<S> | undefined :

0 commit comments

Comments
 (0)