0
0
Fork 0

Upgrade to React 18 (#24916)

This commit is contained in:
Renaud Chaput 2023-05-22 15:48:01 +02:00 committed by GitHub
parent 4a22e72b9b
commit 8d6aea3326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 127 additions and 148 deletions

View file

@ -2,7 +2,7 @@ import './public-path';
import { delegate } from '@rails/ujs';
import ready from '../mastodon/ready';
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
const setAnnouncementEndsAttributes = (target) => {
const valid = target?.value && target?.validity?.valid;
@ -231,11 +231,13 @@ ready(() => {
import('../mastodon/containers/admin_component').then(({ default: AdminComponent }) => {
return import('../mastodon/components/admin/' + componentName).then(({ default: Component }) => {
ReactDOM.render((
const root = createRoot(element);
root.render (
<AdminComponent locale={locale}>
<Component {...componentProps} />
</AdminComponent>
), element);
</AdminComponent>,
);
});
}).catch(error => {
console.error(error);