Refactor context and provider structure for improved organization and maintainability
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Has been cancelled
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Has been cancelled
- Removed individual context files for Auth, Flyers, MasterItems, Modal, UserData, and their respective hooks. - Introduced centralized provider files for each context, encapsulating logic and state management. - Updated imports across the application to reflect the new structure, ensuring all hooks and contexts are correctly referenced. - Enhanced the AppProviders component to streamline the wrapping of all context providers in the application. - Improved type definitions and context management for better type safety and clarity.
This commit is contained in:
14
src/contexts/UserDataContext.ts
Normal file
14
src/contexts/UserDataContext.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// src/contexts/UserDataContext.ts
|
||||
import React from 'react';
|
||||
import type { MasterGroceryItem, ShoppingList } from '../types';
|
||||
|
||||
export interface UserDataContextType {
|
||||
watchedItems: MasterGroceryItem[];
|
||||
shoppingLists: ShoppingList[];
|
||||
setWatchedItems: React.Dispatch<React.SetStateAction<MasterGroceryItem[]>>;
|
||||
setShoppingLists: React.Dispatch<React.SetStateAction<ShoppingList[]>>;
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export const UserDataContext = React.createContext<UserDataContextType | undefined>(undefined);
|
||||
Reference in New Issue
Block a user