Chapter 48: Using randomness
Core Idea
The following thing is an anti-pattern in Remotion:
Key Concepts
- Fixing the problem
- False positives
- Exception: Inside calculateMetadata()
- See also
Code Examples
const MyComp: React.FC = () => {
const [randomValues] = useState(() =>
new Array(10).fill(true).map((a, i) => {
return {
x: Math.random(),
y: Math.random(),
};
}),
);
// Do something with coordinates
return <></>;
};
- What it demonstrates: Usage pattern for Using randomness from the official docs.
Key Takeaways
- Understand fixing the problem when working with Using randomness.
- Understand false positives when working with Using randomness.
- Understand exception: inside calculatemetadata() when working with Using randomness.
- Understand see also when working with Using randomness.
Connects To
- Absolute Fill: related page in the Fundamentals & Core Concepts section.
- Animating Properties: related page in the Fundamentals & Core Concepts section.
- Animation Math: related page in the Fundamentals & Core Concepts section.