🎥 Make videos programmatically with React
react 18 for preview
Jonny Burger4a2f6ebb58a4
diff --git a/packages/cli/src/previewEntry.tsx b/packages/cli/src/previewEntry.tsxindex 62976bb96a..e26912e0fd 100644--- a/packages/cli/src/previewEntry.tsx+++ b/packages/cli/src/previewEntry.tsx@@ -1,4 +1,6 @@-import {render} from 'react-dom';+import ReactDOM from 'react-dom/client';+import type {render} from 'react-dom';+import {Internals} from 'remotion';import '../styles/styles.css';import {Editor} from './editor/components/Editor';@@ -7,9 +9,13 @@ Internals.CSSUtils.injectCSS(Internals.CSSUtils.makeDefaultCSS(null, '#1f2428'));-render(- <Internals.RemotionRoot>- <Editor />- </Internals.RemotionRoot>,- Internals.getPreviewDomElement()-);+if (ReactDOM.createRoot) {+ ReactDOM.createRoot(Internals.getPreviewDomElement() as HTMLElement);+} else {+ (ReactDOM as unknown as {render: typeof render}).render(+ <Internals.RemotionRoot>+ <Editor />+ </Internals.RemotionRoot>,+ Internals.getPreviewDomElement()+ );+}