You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am causing a redirect from my render method using the Redirect component from react-router-dom however as I redirect, I would like to present a toast. Is there a recommended / best practice for doing so?
functionMyComponent(){const[state,setState]=useState(...)if(state=== ....){// as we redirect, we want to show a toastreturn<Redirect....
}
....}
UPDATE:
I could use a useEffect for calling the toast but at that point I might as well just move the entire redirect to an imperative call.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am causing a redirect from my render method using the
Redirect
component fromreact-router-dom
however as I redirect, I would like to present a toast. Is there a recommended / best practice for doing so?UPDATE:
I could use a
useEffect
for calling the toast but at that point I might as well just move the entire redirect to an imperative call.Beta Was this translation helpful? Give feedback.
All reactions