0

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?

Daniel A. White
  • 181,601
  • 45
  • 354
  • 430

2 Answers2

3

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.

Ibro
  • 170
  • 3
1

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

Syed Zain Ali
  • 1,178
  • 1
  • 13
  • 20