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

What is react component in typescript inteface?

$
0
0

In typescript interface, we can define, like :

export interface ViewContainerProps {  style?: ViewStyle | ViewStyle[];  children?: React.ReactNode  aString:string  aNumber:number}

I want to write a custom top-level <View>, to cover all screen, it look like this:

const VIEW_CONTAINER: ViewStyle = {  width: windowWidth,  height: windowHeight,};export interface ViewContainerProps {  style?: ViewStyle | ViewStyle[];  children?: React.ReactNode ///no , something wrong}export const ViewContainer = (props: ViewContainerProps) => {  const {style, children} = props;  return <View style={[style, VIEW_CONTAINER]}>{children}</View>;};

And i want to children return React component to interact and do anything that a react component do, what type of React can i put in typescript interface? I read some docs , say that React.reactNode a light, stateless, immutable, virtual representation of a DOM node, feel like it not what i want when create top-level components that wrap all child components

Please help, thank you a lots


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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