useGetEditor
A hook that returns a function that retrieves the latest EditorApi at call time. This is useful in callbacks, effects, or any logic that runs outside the component render lifecycle.
import { useGetEditor } from "@reacteditor/core";
const Example = () => {
const getEditor = useGetEditor();
const handleClick = useCallback(() => {
// Current EditorApi is always provided
const { appState } = getEditor();
}, [getEditor]);
return <button onClick={handleClick}>Click me</button>;
};If you need to react to changes to EditorApi, try the useEditor hook.
Returns
A function to retrieve the latest EditorApi data at call time.