Teact: Fix multiple use of callback setter
This commit is contained in:
parent
379c5121aa
commit
af06317a0f
@ -556,7 +556,7 @@ export function useState<T>(initial?: T, debugKey?: string): [T, StateHookSetter
|
||||
nextValue: initial,
|
||||
setter: ((componentInstance) => (newValue: ((current: T) => T) | T) => {
|
||||
if (typeof newValue === 'function') {
|
||||
newValue = (newValue as (current: T) => T)(byCursor[cursor].value);
|
||||
newValue = (newValue as (current: T) => T)(byCursor[cursor].nextValue);
|
||||
}
|
||||
|
||||
if (byCursor[cursor].nextValue === newValue) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user