toast and history.push

UI Components for React
Post Reply
susah80
Posts: 2
Joined: 28 Dec 2020, 15:36

28 Dec 2020, 16:09

I have a scenario like this: after a user is successfully registered, I want to show message with toast and also navigate to another route with history.push().
But history.push seems to mess up with toast?
Is there anything to make it work?

Code: Select all

  const history = useHistory();

  const handleRegister = (values) => {
    authService
      .register(values)
      .then((res) => {
        toast.current.show({
          severity: "success",
          summary: "Successfully Registered",
          detail: "You are auto logged in",
        });
        history.push("/");
      })

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests