【发布时间】:2019-04-02 02:30:54
【问题描述】:
我只是 React Hooks 的新手,并且可以玩弄它。
只是想知道是否有任何解决方案可以在 componentDidMount 之后使用 useEffect 多次获取数据。
通常我们使用 useEffect 来根据一些 props 的变化通过传递它们来获取数据。
useEffect(()=> {
fetchApisomefunction()=>{}
},
[]); // normally do this for componentDidMount
之后如何再次获取数据?
更新
回调函数可以解决这个问题。
【问题讨论】:
标签: reactjs react-hooks