Question: How to hook into Context Provider?
jack-ayoka opened this issue · 1 comments
Many react-native functionality involves the use of React.Context
. I'm aware that context hooks only work for functional components, but with class components we have the option of setting the context outside of the class with MyClass.contextType = MyContext
, or inside the class with static contextType = MyContext
. Is there any way to do this in vue-native? For my specific case, I often need access to react-native-paper's theme prop, but can't figure out a way to do so with vue components.
The most reliable way right now to directly interface with React APIs is to write a React component. You can then use that component in Vue components since in the end everything is compiled to React.
In this case it looks like it might be the only option. Dealing with React Context in Vue components is clunky right now. Neither hooks nor context types will work.