()
| 106 | |
| 107 | it('should return the same ref during re-renders', async () => { |
| 108 | function Counter() { |
| 109 | const ref = useRef('val'); |
| 110 | const [count, setCount] = useState(0); |
| 111 | const [firstRef] = useState(ref); |
| 112 | |
| 113 | if (firstRef !== ref) { |
| 114 | throw new Error('should never change'); |
| 115 | } |
| 116 | |
| 117 | if (count < 3) { |
| 118 | setCount(count + 1); |
| 119 | } |
| 120 | |
| 121 | return <Text text={count} />; |
| 122 | } |
| 123 | |
| 124 | ReactNoop.render(<Counter />); |
| 125 | await waitForAll([3]); |