Hooks
Reference guide for React hooks that help you build Replit extensions. Includes hooks for file operations, theme management, and workspace integration.
useReplit
Establishes the handshake between the Replit and the extension and passes the API wrapper for usage inside a React component.
useReplitEffect
Fires a callback with the replit API wrapper upon the first component render and when its dependency array changes.
useWatchTextFile
Allows you to read and write to the contents of a file at the provided filePath.
useActiveFile
Returns the file actively focused on by the current user.
useThemeValues
Provides you with the global token color values of the current user’s theme.
useTheme
Returns all metadata on the current theme including syntax highlighting, description, HSL, token values, and more.
useIsExtension
Returns whether the handshake has been successfully established with the the Replit workspace. If the handshake is loading, undefined will be returned. After loading has finished, the hook will return a boolean.
Was this page helpful?