On this page
useEventCallback
Provides a stable event callback that calls the latest committed handler.
Overview
Copy the source into your project. Import the parts that you need. Styles use local StyleX declarations and shared theme tokens. You can change the source without a wrapper or replacement package.
Preview
Stable handler reading the latest count
Installation
Run the init command from your project root first. The CLI configures StyleX and installs shared files and dependencies.
Run from your project root. The CLI installs required components, shared files, and packages. Previews may need additional components. The CLI keeps existing files.
Usage
The returned function keeps its identity. It calls the latest committed callback. Arguments, return values, promises, and errors do not change.
Use it only for event handlers and effect callbacks. Do not call it during render. A call before the first commit throws an error. Insertion effects publish updates. Aborted renders do not replace the committed callback.
Import from the local file installed by the CLI.
API reference
The generator reads the component TypeScript source. Only component and Base UI props appear below. The Required column shows whether you must supply a property. It does not mean you must use the component.