Skip to content

Commit

Permalink
Merge branch 'gdp/update-react-to-v18' of github.com:lafranceinsoumis…
Browse files Browse the repository at this point in the history
…e/agir.lafranceinsoumise.fr into gdp/update-react-to-v18
  • Loading branch information
giuseppedeponte committed Jun 10, 2022
2 parents ce57fbc + a9020bc commit 3233b2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions agir/lib/components/utils/react.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
import React, { useState } from "react";
import PropTypes from "prop-types";

Expand Down Expand Up @@ -73,8 +73,11 @@ RootComponent.propTypes = {
};

export const renderReactComponent = (component, node) => {
node &&
ReactDOM.render(<React.StrictMode>{component}</React.StrictMode>, node);
if (!node) {
return;
}
const root = createRoot(node);
root.render(<React.StrictMode>{component}</React.StrictMode>);
};

export const mergeRefs = (...refs) => {
Expand Down
1 change: 1 addition & 0 deletions jest/setup.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import "@testing-library/jest-dom/extend-expect";
globalThis.IS_REACT_ACT_ENVIRONMENT = true;

0 comments on commit 3233b2c

Please sign in to comment.