A
A
AlbertP12072019-05-24 22:30:45
React
AlbertP1207, 2019-05-24 22:30:45

Is a component an instance of a class or the class itself in React JS?

When we have

class A extends Component{
 ...
}

and we write <A />. We can say that we create an instance of the class A.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-05-25
@AlbertP1207

JSX is syntactic sugar over the React.createElement call. When you write <A />, you're making a call: React creates an instance of this component under the hood.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question