ai-stories-factory / src /lib /hooks /useStoryPromptDraft.ts
jbilcke-hf's picture
jbilcke-hf HF staff
experimental support for images
82d1e90
raw
history blame contribute delete
469 Bytes
import { useRef } from "react"
import { useLocalStorage } from "usehooks-ts"
import { defaultPrompt, localStorageStoryDraftKey } from "@/app/config"
export function useStoryPromptDraft() {
const [storyPromptDraft, setStoryPromptDraft] = useLocalStorage<string>(
localStorageStoryDraftKey,
defaultPrompt
)
const promptDraftRef = useRef("")
promptDraftRef.current = storyPromptDraft
return { storyPromptDraft, setStoryPromptDraft, promptDraftRef }
}