Skip to content

🎥 Make videos programmatically with React

comment the reason for it

Jonny Burger5c384f3216bb
diff --git a/packages/core/src/audio/shared-audio-tags.tsx b/packages/core/src/audio/shared-audio-tags.tsx
index e30125c25e..6830df9fd1 100644
--- a/packages/core/src/audio/shared-audio-tags.tsx
+++ b/packages/core/src/audio/shared-audio-tags.tsx
@@ -3,8 +3,6 @@ import React, {
createRef,
useCallback,
useContext,
- useInsertionEffect,
- useLayoutEffect,
useMemo,
useRef,
useState,
@@ -288,8 +286,10 @@ export const useSharedAudio = (aud: RemotionAudioProps, audioId: string) => {
* Effects in React 18 fire twice, and we are looking for a way to only fire it once.
* - useInsertionEffect only fires once. If it's available we are in React 18.
* - useLayoutEffect only fires once in React 17.
+ *
+ * Need to import it from React to fix React 17 ESM support.
*/
- const effectToUse = useInsertionEffect ?? useLayoutEffect;
+ const effectToUse = React.useInsertionEffect ?? React.useLayoutEffect;
if (typeof document !== 'undefined') {
effectToUse(() => {
diff --git a/packages/player/src/MediaVolumeSlider.tsx b/packages/player/src/MediaVolumeSlider.tsx
index 99dc655adf..f3c4e9b3ff 100644
--- a/packages/player/src/MediaVolumeSlider.tsx
+++ b/packages/player/src/MediaVolumeSlider.tsx
@@ -16,6 +16,7 @@ export const MediaVolumeSlider: React.FC<{
const parentDivRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLInputElement>(null);
const hover = useHoverState(parentDivRef);
+ // Need to import it from React to fix React 17 ESM support.
const randomId =
// eslint-disable-next-line react-hooks/rules-of-hooks
typeof React.useId === 'undefined' ? 'volume-slider' : React.useId();