import React, { createContext, useContext } from 'react'; import type { ThemeContextValue } from '../types'; const ThemeContext = createContext(undefined); const ThemeProvider = React.memo( ({ children, value }: { children: React.ReactNode; value: ThemeContextValue }) => { return {children}; }, ); export const useThemeContext = () => { const themeContext = useContext(ThemeContext); if (typeof themeContext === 'undefined') { throw new Error( 'useThemeContext must be used within a ThemeProvider\nEnsure that you wrapped your App in a ', ); } return themeContext; }; export default ThemeProvider;