React & Next.js
The @votax572002/fluxfx/react subpath exports ready-to-use wrapper components and the useFX hook, built with React StrictMode cleanup and hot prop updates.
Using Prebuilt Components
Hero.tsx • tsx
'use client';
import { Prism3D, TiltCard, Magnetic } from '@votax572002/fluxfx/react';
export function Hero() {
return (
<Prism3D
as="section"
shape="prism"
depth={1.1}
gloss={1.2}
quality="high"
style={{ minHeight: '75vh', padding: '3rem' }}
>
<TiltCard maxTilt={10} style={{ maxWidth: 360, padding: '1.5rem' }}>
<h2>React + FluxFX</h2>
<Magnetic strength={0.35}>
<button>Get Started</button>
</Magnetic>
</TiltCard>
</Prism3D>
);
} Using the useFX Hook
useFX(effect, options, disabled?) mounts once per effect name / disabled change, then diffs serialized options and calls FluxFX.update() so prop changes never tear down and recreate the WebGL2 context.
CustomCard.tsx • tsx
'use client';
import { useFX } from '@votax572002/fluxfx/react';
export function CustomCard({ fast }: { fast: boolean }) {
const ref = useFX<HTMLDivElement>('aurora', {
speed: fast ? 1.8 : 0.8,
colors: ['#4f46e5', '#06b6d4', '#ec4899'],
});
return <div ref={ref} style={{ minHeight: 280 }}>Content</div>;
} Next.js App Router Notes
- The compiled
dist/react.jsbundle ships with a top-level'use client';banner intsup.config.ts. - If a page/component calls
useFXdirectly or uses client state/handlers, mark that file with'use client';at the top.