Prevent Page Reload on 'Send Message' and Add Success Toast Notification #272
+88
−30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prevent Page Reload on "Send Message" and Add Success Toast Notification #269
Title : Prevent Page Reload on 'Send Message' and Add Success Toast Notification
Issue No. : #269
Code Stack : React.js
Close #269
Video (mandatory)
Screen.Recording.2024-10-18.233233.mp4
Checklist:
README.md
if its a new page/tech stackcontributing.md
file before contributingAdditional context (Mandatory )
I modified the form submission handler to prevent the default behavior of page reloading by using
event.preventDefault(). This ensures that when the "Send Message" button is pressed, the page doesn't reload,
preserving the current state of the application.
I integrated a success toast notification using react-toastify that provides immediate feedback when the form is
successfully submitted. The notification confirms that the message has been sent, enhancing the overall user
experience.
The toast message is styled to align with the application's theme (dark) and automatically closes after 3
seconds, ensuring it's visible long enough for users to see the confirmation without being intrusive.
Are you contributing under any Open-source programme?