import { Code } from '../Code/Code' import { HomeBlockCopy } from './HomeBlockCopy' import { imperativeCode } from './HomeBlockImperative.css' import { section } from './shared.css' const example = /* jsx */ ` import { animated, useSpring } from '@react-spring/web' export default function () { const [styles, api] = useSpring( () => ({ x: 0, rotateZ: 0, }), [] ) const handleClick = () => { api.start({ to: [ { x: 200, rotateZ: 360 }, { x: 0, rotateZ: 0 }, ], }) } return ( Click Me! ) } ` export const HomeBlockImperative = () => (

Use our imperative API methods to run animations without updating state. Respond to events without the react rendering overhead to achieve smooth, fluid animation.

)