Haven't been touching RN for a while, it still remains at ES6 syntax.
Then I saw export default class App extends Component<{}> {
and started wondering what does the <{}> means, anyone can help?
Haven't been touching RN for a while, it still remains at ES6 syntax.
Then I saw export default class App extends Component<{}> {
and started wondering what does the <{}> means, anyone can help?
That's probably related to the type (TypeScript) and the {}
represents the type used for props. Check out this SO answer - TypeScript any vs Object
Looking at the source code for React types interface Component<P = {}, S = {}> extends ComponentLifecycle<P, S> { }
type P is type for props and S is type related to state of component.
Flow
It relate flow typing for the props - https://flow.org/en/docs/react/components/
<{}>
is the definition of an empty object, indicating there are no additional properties for the component.
REFERENCE
React-Native Feature Request