Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
Toast.warn render twice on refresh of page

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]);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can add an ID to your toast to prevent a duplicate toast from appearing.

toast.warn('Please Select Merchant', {
  toastId: "your-id"
});

You can learn more in their documentation: https://fkhadra.github.io/react-toastify/prevent-duplicate

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!