import { createContext, useContext } from "react"; import { type Todo, useTodos } from "./useTodos"; type TodosContextValue = ReturnType; const TodosContext = createContext(null); export function TodosProvider({ children }: { children: React.ReactNode }) { const store = useTodos(); return ( {children} ); } export function useTodosCtx(): TodosContextValue { const ctx = useContext(TodosContext); if (!ctx) { throw new Error("use TodosCtx must be used within "); } return ctx; } export type { Todo };