From db0cf3830e361f1b36d6c0c2d0d51161ace626fe Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Tue, 30 Jul 2024 10:29:06 -0700 Subject: [PATCH] remove nav context --- contexts/NavigationContext.tsx | 41 ---------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 contexts/NavigationContext.tsx diff --git a/contexts/NavigationContext.tsx b/contexts/NavigationContext.tsx deleted file mode 100644 index 9653cc7d..00000000 --- a/contexts/NavigationContext.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { createContext, useContext, useState } from 'react' - -export const NavigationContext = createContext({ - navigate: (route: string) => { - console.log('Navigate to', route) - }, - goBack: () => { - console.log('Go back') - }, - history: [], - currentRoute: '', -}) - -export function Navigator({ children }) { - const [history, setHistory] = useState([]) - const [currentRoute, setCurrentRoute] = useState('') - - const navigate = route => { - setHistory([...history, currentRoute]) - setCurrentRoute(route) - } - - const goBack = () => { - const previousRoute = history.pop() - setCurrentRoute(previousRoute) - } - - return ( - - ) -} - -export function Route({ component }) { - return component -} - -export function useNavigation() { - return useContext(NavigationContext) -}