Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created August 30, 2022 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/e054163ae826a0884c0d902e67661b11 to your computer and use it in GitHub Desktop.
Save tmcw/e054163ae826a0884c0d902e67661b11 to your computer and use it in GitHub Desktop.
import { createContext, useContext } from "react";
import type { IPersistence } from "app/lib/persistence/ipersistence";
const notInContext = {} as IPersistence;
export const PersistenceContext = createContext<IPersistence>(notInContext);
export function usePersistence() {
return useContext(PersistenceContext);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment