I am a beginner using Apollo. I wanted to know, how error handling is done in Mutations and Queries. Currently, I have an Error component, which is a modal. The component looks like this.
import React, { useState } from "react";
import {Modal} from "antd";
const Error = ({ error }) => {
const [visible, setVisible] = useState(true);
return (
<Modal
title = "خطا به وجود آمده است"
visible={visible}
onOk = {() => {
setVisible(false);
}
}
cancelButtonProps={{ type: "text"}}
okText="تایید"
cancelText=" "
>
<p>
متن خطا:
{error.message}
</p>
</Modal>
)
};
export default (Error);
The way I am handling error right now is simply as follows. What should I do if I want the error to not interrupt continuing the code?
{error && <Error error = {error}/>}