123456789101112131415161718192021222324 |
- import { createContext } from "react";
- import { getDateString } from '../utils/date';
- type AppContextType = {
- selectedDate: number,
- setSelectedDate: (selectedDate: number) => void,
- calorieItems: CalorieItems;
- setCalorieItems: (calorieItems: CalorieValue[]) => void,
- selectedItem: CalorieValue | undefined,
- setSelectedItem: (item?: CalorieValue) => void
- };
- const AppContext = createContext<AppContextType>({
- calorieItems: [],
- selectedDate: Date.now(),
- selectedItem: undefined,
- setCalorieItems: () => [],
- setSelectedDate: () => getDateString(new Date()),
- setSelectedItem: () => {}
- });
- export {
- AppContext
- };
|