I wrote this code
switch (ReactDOM.querySelector("#myapp")) {
| Some(myapp) => ReactDOM.createRoot(myapp).render(<MyComponent />)
| None => Js.log("we could not find myapp div!"); ()
};
However Rescript compiler complains The value createRoot can't be found in ReactDOM
but I am googling and I find that this is the correct way and older ReactDOM.render call raises a warning.
How to solve?
Edit: I tried ReactDOM.Experimental.createRoot(myapp).render(<MyComponent />)
but now it says The record field render can't be found.