Is a good practice to fetch data in javascript class constructor()
?
E.g. In react class constructor()
, every tutorial which I find fetch data in componendDidMount()
, but no one explein why We can't do it in constructor()
.
Question concerns javascript classes at all, not only react
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…