From 5bd157f8fc6ea4b7f871db98e659463f67a4528f Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Tue, 16 Nov 2021 18:33:51 +0200 Subject: [PATCH] refactor(app): wrap react with StrictMode [EE-2023] (#6075) --- app/react-tools/RootProvider.tsx | 10 ++++++++++ app/react-tools/react2angular.tsx | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 app/react-tools/RootProvider.tsx diff --git a/app/react-tools/RootProvider.tsx b/app/react-tools/RootProvider.tsx new file mode 100644 index 000000000..5942afcff --- /dev/null +++ b/app/react-tools/RootProvider.tsx @@ -0,0 +1,10 @@ +import { UIRouterContextComponent } from '@uirouter/react-hybrid'; +import { PropsWithChildren, StrictMode } from 'react'; + +export function RootProvider({ children }: PropsWithChildren) { + return ( + + {children} + + ); +} diff --git a/app/react-tools/react2angular.tsx b/app/react-tools/react2angular.tsx index 611d125a2..789dbf9e3 100644 --- a/app/react-tools/react2angular.tsx +++ b/app/react-tools/react2angular.tsx @@ -1,7 +1,8 @@ -import { UIRouterContextComponent } from '@uirouter/react-hybrid'; import ReactDOM from 'react-dom'; import { IComponentOptions, IController } from 'angular'; +import { RootProvider } from './RootProvider'; + function toProps( propNames: string[], controller: IController, @@ -44,10 +45,10 @@ export function react2angular( this.$onChanges = () => { const props = toProps(propNames, this, $q); ReactDOM.render( - + {/* eslint-disable-next-line react/jsx-props-no-spreading */} - , + , el ); };