diff --git a/packages/react/src/useEditor.ts b/packages/react/src/useEditor.ts index 165e52d6..f2f3fcda 100644 --- a/packages/react/src/useEditor.ts +++ b/packages/react/src/useEditor.ts @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react' +import { useState, useEffect, DependencyList } from 'react' import { EditorOptions } from '@tiptap/core' import { Editor } from './Editor' @@ -8,7 +8,7 @@ function useForceUpdate() { return () => setValue(value => value + 1) } -export const useEditor = (options: Partial = {}) => { +export const useEditor = (options: Partial = {}, deps: DependencyList = []) => { const [editor, setEditor] = useState(null) const forceUpdate = useForceUpdate() @@ -22,7 +22,7 @@ export const useEditor = (options: Partial = {}) => { return () => { instance.destroy() } - }, []) + }, deps) return editor }