fix(react): too soon for strict mode

This commit is contained in:
Paul Chavard 2022-04-28 14:45:35 +02:00
parent 1e0efcc4ec
commit 67ba8acff7

View file

@ -1,5 +1,5 @@
import { Controller } from '@hotwired/stimulus'; import { Controller } from '@hotwired/stimulus';
import React, { lazy, Suspense, FunctionComponent, StrictMode } from 'react'; import React, { lazy, Suspense, FunctionComponent } from 'react';
import { render, unmountComponentAtNode } from 'react-dom'; import { render, unmountComponentAtNode } from 'react-dom';
import invariant from 'tiny-invariant'; import invariant from 'tiny-invariant';
@ -44,12 +44,7 @@ export class ReactController extends Controller {
Component, Component,
`Cannot find a React component with class "${componentName}"` `Cannot find a React component with class "${componentName}"`
); );
render( render(<Component {...props} />, node);
<StrictMode>
<Component {...props} />
</StrictMode>,
node
);
} }
private getComponent(componentName: string): FunctionComponent<Props> | null { private getComponent(componentName: string): FunctionComponent<Props> | null {