Replies: 1 comment 1 reply
-
|
用 useState 存一下 useRequest 的 onSuccess 回调里获取的数据,然后可以在把这个 state 传给你上面的代码。 const [myData, setMyData] = useState<any[]>([]); // 这里类型自行标注
const { data } = useRequest(async () => {
const fetchList = [];
return [...myData, ...fetchList]
}, {
onSuccess: (_data) => {
setMyData(_data);
}
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
我想要
但是会提示
我的data类型就变成any了
Beta Was this translation helpful? Give feedback.
All reactions