import React, { createContext, useContext, useState } from 'react'; interface EditorContextType { isMutating: boolean; setIsMutating: React.Dispatch>; currentCode?: string; setCurrentCode: React.Dispatch>; } const EditorContext = createContext(undefined); export function EditorProvider({ children }: { children: React.ReactNode }) { const [isMutating, setIsMutating] = useState(false); const [currentCode, setCurrentCode] = useState(); return ( {children} ); } export function useEditorContext() { const context = useContext(EditorContext); if (context === undefined) { throw new Error('useEditorContext must be used within an EditorProvider'); } return context; }