I'm facing an issue where the toast message is rendered twice on page load.
The props are being passed with Link
<Link to={{ pathname: `/administration/person/add`, merchantData: { merchant } }}>Create Person</Link>
and another page by grabbing the data with useLocation
cons {merchantData} = useLocation();
What I want is on page load and when the data is lost, it should give a warning message with the code below.
useEffect(() => {
if (merchantData === undefined) {
toast.warn('Please Select Merchant');
}
}, [merchantData]);