Replies: 1 comment 1 reply
-
|
You would want a temporary alert of some kind that listens to The state would be managed similar to this: function YourComponent({ isSubmitSuccessful }) {
const [showSuccess, setShowSuccess] = useState(isSubmitSuccessful);
useEffect(() => {
if (isSubmitSuccessful) {
setShowSuccess(true);
const timer = setTimeout(() => setShowSuccess(false), 3000);
return () => clearTimeout(timer);
}
}, [isSubmitSuccessful]);
// ...
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to show some state on the submit button that indicate submit operation was successful and goes away after a few seconds. The
isSubmitSuccessfulexists, but it is not temporary. How do you do it? What's the simplest way?Beta Was this translation helpful? Give feedback.
All reactions