Simple example provided by @threepointone on Twitter:
function App(){
let [val, setVal] = useState(0);
let memoed = useAutoMemo(() => someLocallyScopedFunc());
function someLocallyScopedFunc() {
return val * 2;
}
}
We currently get:
function App(){
let [val, setVal] = useState(0);
let memoed = useMemo(
() => someLocallyScopedFunc(),
[someLocallyScopedFunc]
// we would want [val] here!
);
function someLocallyScopedFunc()() {
return val * 2;
}
}
Simple example provided by @threepointone on Twitter:
We currently get: