Match-id-dd619e8d054f2fd3bac30ca85925d001505434ee
This commit is contained in:
parent
580beb2ca6
commit
90ab25303d
|
@ -3,7 +3,6 @@ import {EffectConstant} from './EffectConstant';
|
||||||
export interface Hook<S, A> {
|
export interface Hook<S, A> {
|
||||||
state: Reducer<S, A> | Effect | Memo<S> | CallBack<S> | Ref<S>;
|
state: Reducer<S, A> | Effect | Memo<S> | CallBack<S> | Ref<S>;
|
||||||
hIndex: number;
|
hIndex: number;
|
||||||
type?: 'useState' | 'useRef' | 'useReducer';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Reducer<S, A> {
|
export interface Reducer<S, A> {
|
||||||
|
|
|
@ -87,7 +87,6 @@ export function useReducerForInit<S, A>(reducer, initArg, init, isUseState?: boo
|
||||||
}
|
}
|
||||||
|
|
||||||
const hook = createHook();
|
const hook = createHook();
|
||||||
hook.type = isUseState ? 'useState' : 'useReducer';
|
|
||||||
// 为hook.state赋值{状态值, 触发函数, reducer, updates更新数组, 是否是useState}
|
// 为hook.state赋值{状态值, 触发函数, reducer, updates更新数组, 是否是useState}
|
||||||
hook.state = {
|
hook.state = {
|
||||||
stateValue: stateValue,
|
stateValue: stateValue,
|
||||||
|
|
|
@ -12,7 +12,6 @@ export function useRefImpl<V>(value: V): Ref<V> {
|
||||||
if (stage === HookStage.Init) {
|
if (stage === HookStage.Init) {
|
||||||
hook = createHook();
|
hook = createHook();
|
||||||
hook.state = {current: value};
|
hook.state = {current: value};
|
||||||
hook.type = 'useRef';
|
|
||||||
} else if (stage === HookStage.Update) {
|
} else if (stage === HookStage.Update) {
|
||||||
hook = getCurrentHook();
|
hook = getCurrentHook();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue