let stateList = [];
let index = 0;
function useState(init) {
let nowIndex = index++;
if (stateList[nowIndex] === undefined) {
stateList[nowIndex] = init;
}
return (
[stateList[nowIndex]],
(newState) => {
stateList[nowIndex] = newState;
render();
}
);
}