main
js 18 lines 436 Bytes
Raw
1 // @validateNoSetStateInEffects @enableAllowSetStateFromRefsInEffects @outputMode:"lint"
2 import {useState, useRef, useLayoutEffect} from 'react';
3
4 function Component() {
5 const ref = useRef({size: 5});
6 const [computedSize, setComputedSize] = useState(0);
7
8 useLayoutEffect(() => {
9 setComputedSize(ref.current.size * 10);
10 }, []);
11
12 return computedSize;
13 }
14
15 export const FIXTURE_ENTRYPOINT = {
16 fn: Component,
17 params: [],
18 };