【发布时间】:2021-07-14 09:15:47
【问题描述】:
当我开始测试时会出现警告:
警告:测试内部的更新未包含在 行动(...)。
它是由捕获错误引起的:
const getPeople = () => {
const url = "https://api";
axios(url)
.then((res) => {
setPeople(res.data.results);
})
.catch(function () {
setError(true);
});
};
如果我删除catch,一切正常,但我想拥有它,有没有办法做到这一点?
【问题讨论】: