Download slate/packages/slate-react/src/hooks/use-editor.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 425 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/packages/slate-react/src/hooks/use-editor.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/slate/packages/slate-react/src/hooks/use-editor.tsx
-
curl -L -o use-editor.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/packages/slate-react/src/hooks/use-editor.tsx
425 Bytes
| import { useContext } from 'react' | |
| import { EditorContext } from './use-slate-static' | |
| /** | |
| * Get the current editor object from the React context. | |
| * @deprecated Use useSlateStatic instead. | |
| */ | |
| export const useEditor = () => { | |
| const editor = useContext(EditorContext) | |
| if (!editor) { | |
| throw new Error( | |
| `The \`useEditor\` hook must be used inside the <Slate> component's context.` | |
| ) | |
| } | |
| return editor | |
| } | |