D
D
Denis2017-07-28 14:02:49
React
Denis, 2017-07-28 14:02:49

How to understand how the getInitialState method works?

Hello. While studying React, I come across a description of the getInitialState method inside the component class. But the method (getInitialState) is not called anywhere. Is it some kind of internal component method? Help me to understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
davidnum95, 2017-07-28
@davidnum95

In ES6, the class constructor is used to set the initial state, and since there are no classes in ES5, this method and several others are used .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question