Temp(?) note refactors

This commit is contained in:
2026-01-23 11:53:57 +00:00
parent b5a84c076d
commit b5ac1df4e3
4 changed files with 41 additions and 26 deletions

View File

@@ -1,18 +1,17 @@
import { createContext, Dispatch, SetStateAction, ReactNode, useContext, useState } from "react";
import { Note } from "../models/Note";
type ActiveNoteType = {
currentNote: Note | null;
setCurrentNote: Dispatch<SetStateAction<Note | null>>;
currentNoteId: string | null;
setCurrentNoteId: Dispatch<SetStateAction<string | null>>;
}
const ActiveNote = createContext<ActiveNoteType | null>(null);
export function NoteProvider({ children }: { children: ReactNode }) {
const [currentNote, setCurrentNote] = useState<Note | null>(null);
const [currentNoteId, setCurrentNoteId] = useState<string | null>(null);
return (
<ActiveNote.Provider value={{ currentNote, setCurrentNote }}>
<ActiveNote.Provider value={{ currentNoteId, setCurrentNoteId }}>
{children}
</ActiveNote.Provider>
);