Skip to content

Instantly share code, notes, and snippets.

@FreddyPoly
Created June 28, 2019 16:05
Show Gist options
  • Save FreddyPoly/ec03432184c459889b4951e8e9ed0087 to your computer and use it in GitHub Desktop.
Save FreddyPoly/ec03432184c459889b4951e8e9ed0087 to your computer and use it in GitHub Desktop.
[REACT NATIVE] Example component TypeScript
import * as React from "react"
import { View, Text } from "react-native"
export interface Props {
propsVar: any;
}
export interface State {
stateVar: any;
}
export class Asset extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
stateVar: 'Variable du state',
}
}
render() {
return (
<View>
<Text>State: { this.state.stateVar }</Text>
<Text>Props: { this.props.propsVar }</Text>
</View>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment