Use componentWillMount or componentDidMount lifecycle functions for async request in React

前端 未结 3 1381
猫巷女王i
猫巷女王i 2020-11-27 07:16

I am reading up on react lifecycle and am getting a little confused. Some recommend using componentWillMount to make ajax calls:

https://hashnode.com/post/why-is-it-

3条回答
  •  忘掉有多难
    2020-11-27 08:10

    componentDidMount is the recommended lifecycle method to make Ajax calls as described in their docs

提交回复
热议问题