Skip to content

Commit

Permalink
Migrate to reason-react next version with React 18 (#28)
Browse files Browse the repository at this point in the history
* Install react/react-dom@18

* Migrate to new React.DOM.Client.createRoot/render API

* Add pinning on Makefile install

* fix build

---------

Co-authored-by: Javier Chavarri <[email protected]>
  • Loading branch information
davesnx and jchavarri authored Mar 7, 2024
1 parent 4252e1d commit 88b0aed
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/ReactApp.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ module App = {
->React.array;
};

ReactDOM.querySelector("#root")
->(
fun
| Some(root) => ReactDOM.render(<App />, root)
| None =>
Js.Console.error(
"Failed to start React: couldn't find the #root element",
)
);
switch (ReactDOM.querySelector("#root")) {
| Some(element) =>
let root = ReactDOM.Client.createRoot(element);
ReactDOM.Client.render(root, <App />);
| None =>
Js.Console.error("Failed to start React: couldn't find the #root element")
};

0 comments on commit 88b0aed

Please sign in to comment.