Skip to content

🎥 Make videos programmatically with React

react 18

Jonny Burgerc0574620da3c
diff --git a/packages/docs/docs/3-0-migration.md b/packages/docs/docs/3-0-migration.md
index dff8aac2b3..e465641c36 100644
--- a/packages/docs/docs/3-0-migration.md
+++ b/packages/docs/docs/3-0-migration.md
@@ -14,7 +14,9 @@ Previously, we supported Node 12 and 13, but we no longer do.
## Remotion is built with React 18 types
-The Remotion components adhere to version 18 of `@types/react` and `@types/react-dom`. Minor type errors may occur that can be resolved by adjusting your components. We recommend that you upgrade the `@types/react` package yourself.
+The Remotion components adhere to [version 18 of `@types/react` and `@types/react-dom`](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56210). Minor type errors may occur that can be resolved by adjusting your components. We recommend that you upgrade the `@types/react` package yourself.
+
+**Upgrade path:** [Update to React 18](/docs/react-18) - optional but recommended.
## `renderFrames()`/`renderStill()`: `compositionId` parameter removed
diff --git a/packages/docs/docs/react-18.md b/packages/docs/docs/react-18.md
new file mode 100644
index 0000000000..332411f355
--- /dev/null
+++ b/packages/docs/docs/react-18.md
@@ -0,0 +1,57 @@
+---
+id: react-18
+title: Upgrade to React 18
+---
+
+## Updating packages
+
+To use React 18, you need at least version `3.0.0` of Remotion.
+
+```diff
+- "remotion": "2.6.15"
+- "@remotion/bundler": "2.6.15"
+- "@remotion/cli": "2.6.15"
+- "@remotion/renderer": "2.6.15"
++ "remotion": "3.0.0"
++ "@remotion/bundler": "3.0.0"
++ "@remotion/cli": "3.0.0"
++ "@remotion/renderer": "3.0.0"
+```
+
+You need to upgrade both `react` and `react-dom`:
+
+```diff
+- "react": "17.0.1"
+- "react-dom": "17.0.1"
++ "react": "18.0.0"
++ "react-dom": "18.0.0"
+```
+
+If you use TypeScript, update to the newest types as well:
+
+```diff
+- "@types/react": "17.0.3"
++ "@types/react": "18.0.0"
+```
+
+Run `npm i`, or `yarn`, or `pnpm i` afterwards, matching your package manager.
+
+## Fixing `React.FC` types
+
+The types for `React.FC` have changed to no longer include `children`. If you get a type error, change
+
+```tsx
+const MyComp: React.FC = ({ children }) => <div>{children}</div>;
+```
+
+to:
+
+```tsx
+const MyComp: React.FC<{
+ children: React.ReactNode;
+}> = ({ children }) => <div>{children}</div>;
+```
+
+## No action required for `createRoot()`
+
+If React 18 is installed, Remotion will automatically use `createRoot()` from `react-dom/client` instead of `render` from `react-dom`. You don't need to do anything.
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 974533f9f2..ecd539c72a 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -243,7 +243,7 @@ module.exports = {
type: "category",
label: "Miscellaneous",
collapsed: false,
- items: ["chromium-flags", "prereleases", "gpu"],
+ items: ["chromium-flags", "prereleases", "gpu", "react-18"],
},
"3-0-migration",
"2-0-migration",