What's the best way to git rid of SerializedError
from error
using RTK Query, like in the example here: https://redux-toolkit.js.org/rtk-query/usage/error-handling. Also is there an example out there typing the error for individual queries? Thanks in advance
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>
)
}