Skip to content

🎥 Make videos programmatically with React

Update data-fetching.md

Jonny Burger44f1ea91906b
diff --git a/packages/docs/docs/data-fetching.md b/packages/docs/docs/data-fetching.md
index c41ed849ae..f9053f553c 100644
--- a/packages/docs/docs/data-fetching.md
+++ b/packages/docs/docs/data-fetching.md
@@ -10,11 +10,17 @@ crumb: "How to"
You may use the [`calculateMetadata`](/docs/composition#calculatemetadata) prop of the [`<Composition />`](/docs/composition) component to alter the props that get passed to your React component.
```tsx twoslash
-const MyVideo: React.FC = () => null;
// ---cut---
import { useCallback } from "react";
import { Composition } from "remotion";
+type MyVideoProps = {
+ title: string;
+ description: string;
+};
+
+const MyVideo: React.FC<MyVideoProps> = () => null;
+
export const Root: React.FC = () => {
const calculateMyVideoMetadata = useCallback(async () => {
const data = await fetch("http://example.com/api");
@@ -33,6 +39,10 @@ export const Root: React.FC = () => {
fps={30}
width={1920}
height={1080}
+ defaultProps={{
+ title: "My video",
+ description: "This is my video",
+ }}
calculateMetadata={calculateMyVideoMetadata}
/>
);