example-react
Patterns for using Helios with React. Use when building compositions in a React environment.
Best use case
example-react is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Patterns for using Helios with React. Use when building compositions in a React environment.
Teams using example-react should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/react/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How example-react Compares
| Feature / Agent | example-react | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Patterns for using Helios with React. Use when building compositions in a React environment.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# React Composition Patterns
Integrate Helios into React components using hooks for state management and Refs for canvas access.
## Quick Start
### 1. Create `useVideoFrame` Hook
This hook subscribes to Helios and returns the current frame, triggering re-renders.
```javascript
// hooks/useVideoFrame.js
import { useState, useEffect } from 'react';
export function useVideoFrame(helios) {
const [frame, setFrame] = useState(helios.currentFrame.peek());
useEffect(() => {
// Subscribe to updates
const unsubscribe = helios.subscribe((state) => {
setFrame(state.currentFrame);
});
return unsubscribe;
}, [helios]);
return frame;
}
```
### 2. Create Composition Component
```jsx
// App.jsx
import React, { useRef, useEffect } from 'react';
import { Helios } from '@helios-project/core';
import { useVideoFrame } from './hooks/useVideoFrame';
// Initialize Singleton (outside component to persist across re-renders)
const helios = new Helios({
duration: 10,
fps: 30
});
helios.bindToDocumentTimeline();
// Expose for Renderer/Player
if (typeof window !== 'undefined') window.helios = helios;
export default function App() {
const canvasRef = useRef(null);
const frame = useVideoFrame(helios);
useEffect(() => {
const ctx = canvasRef.current?.getContext('2d');
if (!ctx) return;
const { width, height } = canvasRef.current;
// Clear
ctx.clearRect(0, 0, width, height);
// Draw based on frame
const progress = frame / (helios.duration * helios.fps);
ctx.fillStyle = '#61dafb';
ctx.fillRect(progress * width, height / 2 - 50, 100, 100);
}, [frame]); // Re-run draw when frame changes
return <canvas ref={canvasRef} width={1920} height={1080} />;
}
```
## Optimization
For complex scenes, avoid React state updates for every frame (which triggers full component re-render). Instead, use a `useRef` to hold the frame and an animation loop, or update the canvas imperatively inside `subscribe`.
### Imperative Pattern (High Performance)
```jsx
useEffect(() => {
const ctx = canvasRef.current.getContext('2d');
const unsubscribe = helios.subscribe((state) => {
// Draw directly without triggering React render
drawScene(ctx, state.currentFrame);
});
return unsubscribe;
}, []);
```
## Source Files
- Example: `examples/react-canvas-animation/`Related Skills
example-vue
Patterns for using Helios with Vue. Use when building compositions in a Vue environment.
example-vanilla
Patterns for using Helios with Vanilla JavaScript/TypeScript. Use when building compositions without a framework, or for simple DOM/Canvas manipulations.
example-threejs
Patterns for using Helios with Three.js and React Three Fiber. Use when creating 3D animations or integrating WebGL scenes.
example-tailwind-animation
Learn how to use Tailwind CSS with Helios. Use for styling compositions and animating with utility classes.
example-svelte
Patterns for using Helios with Svelte. Use when building compositions in a Svelte environment, utilizing Svelte stores for reactive frame updates.
example-solid
Patterns for using Helios with SolidJS. Use when building compositions in a SolidJS environment, utilizing signals for fine-grained reactivity.
example-signals-animation
Learn how to use Helios Signals for high-performance, fine-grained reactivity. Use for complex dependency graphs or when optimizing performance.
example-podcast-visualizer
Workflow for creating a podcast visualizer with multi-track audio mixing and DOM-based synchronization. Use when building audio-reactive compositions.
example-pixi
PixiJS integration patterns for Helios. Use when creating high-performance WebGL 2D animations with PixiJS.
example-p5-animation
Learn how to use P5.js with Helios. Use when creating creative coding sketches or generative art.
example-lottie
Lottie integration patterns for Helios. Use when rendering Lottie (Bodymovin) JSON animations synchronously with Helios.
example-gsap
Patterns for using Helios with GSAP (GreenSock). Use when integrating GSAP timelines with the Helios timeline for precise scrubbing and rendering.