updateDefaultProps()v4.0.154
Deprecated: This function is an alias for saveDefaultProps(). Use saveDefaultProps() instead.
Before v4.0.437, this function only updated the props in the Props Editor without saving them to the root file.
Starting from v4.0.437, all prop changes are immediately saved, making this function identical to saveDefaultProps().
Examples
Setting {color: 'green'} as the default propsimport {saveDefaultProps } from "@remotion/studio"; awaitsaveDefaultProps ({compositionId : "my-composition",defaultProps : () => { return {color : "green", }; }, });
You can access the current default props to only override part of it (reducer-style):
Accessing the current propsimport {saveDefaultProps } from "@remotion/studio"; awaitsaveDefaultProps ({compositionId : "my-composition",defaultProps : ({savedDefaultProps }) => { return { ...savedDefaultProps ,color : "green" }; }, });
If you have a Zod schema, you can also access its runtime value:
Accessing the Zod schemaimport {saveDefaultProps } from "@remotion/studio"; awaitsaveDefaultProps ({compositionId : "my-composition",defaultProps : ({schema ,savedDefaultProps }) => { // Do something with the Zod schema return { ...savedDefaultProps ,color : "red", }; }, });
unsavedDefaultProps
Before v4.0.437, unsavedDefaultProps contained props that were modified in the Props Editor but not yet written back to the root file.
Starting from v4.0.437, all prop changes are immediately saved, so unsavedDefaultProps is now always the same as savedDefaultProps.
It is still accepted for backwards compatibility, but you should use savedDefaultProps instead.
Requirements
In order to use this function:
You need to be inside the Remotion Studio.The Studio must be running (no static deployment)
zod needs to be installed.
Otherwise, the function will throw.