export function useState(initialValue) {
states[hookIndex] = states[hookIndex] || initialValue;
const currentIndex = hookIndex; //这段代码赋值有问题啊 hookIndex一直是 0 啊!请老师解答下
function setState(newState) {
states[currentIndex] = newState;
emitUpdateForHooks();
}
return [states[hookIndex++], setState];
}
const currentIndex = hookIndex; 这段代码赋值有问题啊 hookIndex一直是 0 啊!请老师解答下