Reputation: 355
What's does type Props = {};
mean in React Native project?
It's used in extends Component<Props>
Is it flow? But I don't see flow in dependecies.
Visual Studio Code says it's an error. But everything compiles without problems.
Upvotes: 2
Views: 60
Reputation: 317
It is a TypeScript code. extends Component means that your class/ component props will have to conform with that Props type.
For example,
type Props = {
name: string
}
class Example extends Component<Props> {
...
}
Later, when you want to use that component, you should put the props like this
<Example name='test'/>
If not, TypeScript will give you a compile error.
Upvotes: 4