Reputation: 115
I am familiar with react and now i have just created a react native project using react-native init command. I noticed in App.js file like this ,
export default class App extends Component<Props> {
}
What does mean <Props>
here.?
Upvotes: 2
Views: 1212
Reputation: 7563
That code uses Flow, which is a type checker for JavaScript written by Facebook.
The React documentation explains how it is used here:
We removed our dependency on prop-types and added a Flow object type named Props with the same shape as the prop types but using Flow’s static type syntax. Then we passed our new Props type into React.Component as a type argument.
The Flow type checker can then tell you if you're sending wrong types as your component props (instead of using prop-types
).
Upvotes: 2
Reputation: 882
That's for Flow
type. You can read about react-native
's flow types here https://medium.com/react-native-training/getting-started-with-react-native-and-flow-d40f55746809
Upvotes: 1