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

React Native 's children type (TypeScript)

$
0
0

What is the type of <Text>'s children property in React Native?

Let's say, I'm creating component that is HOC over the <Text>, and I want to support all the same children types as a normal <Text>.

type Props = {  children: ???;}const MyText = ({children}: Props) => <Text>{children}</Text>

The type cannot be just a string since React Native's <Text> supports also component nesting, fragments, and arrays as children.


Viewing all articles
Browse latest Browse all 6212

Trending Articles



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