You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useLayoutEffect runs multiple times while using ReactDOMClient.createRoot
Reproduce Code
import*asReactfrom'react';import{render}from'react-dom';import{createRoot}from'react-dom/client';import{Freeze}from'react-freeze';constrootElement=document.getElementById('root')render(<App/>,rootElement);// √createRoot(rootElement).render(<App/>);// xfunctionTest(){React.useLayoutEffect(()=>{console.log('run useLayoutEffect');// Log is executed for each unfreezing},[]);return<div>test</div>;}functionApp(){const[freeze,setFreeze]=React.useState(false);return(<div><buttononClick={()=>setFreeze(!freeze)}>toggle freeze state</button><Freezefreeze={freeze}><Test/></Freeze></div>);}
The text was updated successfully, but these errors were encountered:
CJY0208
changed the title
useLayoutEffect runs multiple times while using ReactDOMClient.createRoot
[React18] useLayoutEffect runs multiple times while using ReactDOMClient.createRoot
Nov 11, 2022
Problem
useLayoutEffect
runs multiple times while usingReactDOMClient.createRoot
Reproduce Code
The text was updated successfully, but these errors were encountered: