Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6212

Import Error while importing provider from provider file

$
0
0

Here I am getting error like

import error: 'LanguageProvider' is not exported from 'contexts/language/language.provider'.

language.provider.tsx

import React from 'react';const LanguageContext = React.createContext({} as any);export const LanguageProvider = ({ children, messages, initLocale }) => {  const [locale, setLocale] = React.useState(initLocale ?? 'en');  const changeLanguage = (newLocale): void => {    ...  };  let isRtl = isRTL(locale);  return (<LanguageContext.Provider value={{ locale, changeLanguage, isRtl }}>      ...</LanguageContext.Provider>  );};export const useLocale = () => React.useContext(LanguageContext);

_app.tsx

import React from "react";import App from "next/app";import { LanguageProvider } from "contexts/language/language.provider";// need to provide typesexport default function ExtendedApp({  Component,  pageProps,  userAgent,  locale,  query,}) {  const deviceType = useDeviceType(userAgent);  return (<ThemeProvider theme={theme}><LanguageProvider messages={messages} initLocale={locale}>        ...</LanguageProvider></ThemeProvider>  );}

Can anyone please help me with this?


Viewing all articles
Browse latest Browse all 6212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>