Feature/update dependency react to v18.x (#346)
* Update dependency "react" to v18.x Update to v18.2.0 * Update dependency "react" to v18.x - Fix some dependency version issue Something caused weird tsc issues, most likely a version mismatch since it got fixed by doing a clean install (deleting node_modules folder, yarn.lock and clearing the cache) of the dependencies * Update dependency "react" to v18.x - Fix "i18n" tsc issues * Update dependency "react" to v18.x - Fix tsc issue Typography can only have a single child * Update dependency "react" to v18.x - Prevent build warning TODO: migrate to Vite Gets used without being declared as a dependency. Since CRA is unmaintained this will not get fixed. * Update dependency "react" to v18.x - Use "createRoot" * Update dependency "react" to v18.x - Fix dnd in strict mode
This commit is contained in:
@@ -6,16 +6,14 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import ReactDOM from 'react-dom';
|
||||
import React from 'react';
|
||||
import Slide, { SlideProps } from '@mui/material/Slide';
|
||||
import Snackbar from '@mui/material/Snackbar';
|
||||
import MuiAlert, { AlertColor as Severity } from '@mui/material/Alert';
|
||||
import { createRoot, Root } from 'react-dom/client';
|
||||
|
||||
function removeToast(id: string) {
|
||||
const container = document.querySelector(`#${id}`)!!;
|
||||
ReactDOM.unmountComponentAtNode(container);
|
||||
document.body.removeChild(container);
|
||||
function removeToast(root: Root) {
|
||||
root.unmount();
|
||||
}
|
||||
|
||||
function Transition(props: SlideProps) {
|
||||
@@ -57,9 +55,10 @@ export default function makeToast(message: string, severity: Severity) {
|
||||
|
||||
document.body.appendChild(container);
|
||||
|
||||
ReactDOM.render(<Toast message={message} severity={severity} />, container);
|
||||
const root = createRoot(container!);
|
||||
root.render(<Toast message={message} severity={severity} />);
|
||||
|
||||
setTimeout(() => removeToast(container.id), 3500);
|
||||
setTimeout(() => removeToast(root), 3500);
|
||||
}
|
||||
|
||||
export function makeToaster([toasts, setToasts]: [React.ReactElement[], (arg0: React.ReactElement[]) => void]): [
|
||||
|
||||
Reference in New Issue
Block a user