SerializedError
摆脱使用 RTK Query的最佳方法是什么error
,例如此处的示例:https ://redux-toolkit.js.org/rtk-query/usage/error-handling 。还有一个例子可以为单个查询输入错误吗?提前致谢
function PostsList() {
const { data, error } = useGetPostsQuery()
// error: FetchBaseQueryError | SerializedError | undefined
// Property 'status' does not exist on type 'FetchBaseQueryError | SerializedError'.
// How do I check if it's a FetchBaseQueryError before continuing
return (
<div>
{error.status} {JSON.stringify(error.data)}
</div>
)
}