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

How can I create a Context that has a reference inside in Typescript?

$
0
0

I am trying to create a context that has a reference inside it in React Native using Typescript, however, I am getting all sorts of type errors and I do not seem able to fix it. I want it to be null by default, but I'm not being able to do it.

const WebContext: RefObject<WebView<{}>> | null = createContext(null);

It is raising this error: Property 'current' is missing in type 'Context<null>' but required in type 'RefObject<WebView<{}>>'.

What am I doing wrong? How could I initialise this to null while being able to set it's value to a reference of a WebView later?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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