Capítulo 60 de 988

Chapter 60: getRemotionEnvironment()

Core Idea

With the getRemotionEnvironment() function, you can retrieve information about the current Remotion Environment.

Key Concepts

  • Example
  • Compatibility
  • See also

Code Examples

export const MyComp: React.FC = () => {
  const {isStudio, isPlayer, isRendering} = getRemotionEnvironment();

  if (isStudio) {
    return <div>I'm in the Studio!</div>;
  }

  if (isPlayer) {
    return <div>I'm in the Player!</div>;
  }

  if (isRendering) {
    return <div>I'm Rendering</div>;
  }

  return <div>Hello World!</div>;
};
  • What it demonstrates: Usage pattern for getRemotionEnvironment() from the official docs.

Key Takeaways

  1. Understand example when working with getRemotionEnvironment().
  2. Understand compatibility when working with getRemotionEnvironment().
  3. Understand see also when working with getRemotionEnvironment().

Connects To

  • Cancel Render: related page in the Hooks & Data APIs section.
  • Continue Render: related page in the Hooks & Data APIs section.
  • Data Fetching: related page in the Hooks & Data APIs section.