Skip to content

the-road-to-learn-react/react-autosave-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Autosave by Example

Auto save runs every time a user clicks something (e.g. button, option, select) or leaves an input field.

Sep-05-2020 11-08-47

If a user navigates away (React Router) or hides the component (conditional rendering), the form is auto saved if all required fields are filled.

Sep-05-2020 11-19-44

If a required field isn't filled (here "First Name"), there will be an intercepting dialog which asks you to discard the changes ("Discard" button) or to continue with the form ("Cancel" button).

Sep-05-2020 11-10-48

Caveat: The intercepting Dialog is triggered whenever a user clicks outside of the form and not all required fields are filled to be saved. An alternative implementation would be to call this dialog only if a user navigates away (e.g. click "Home" link) or removes the component (e.g. click "User ID: 2" option). The former could be easily integrated once in React Router. However, the latter would need to be implemented for every user interaction (e.g. "User ID: 2"), which removes the form, on this page.

Installation

  • git clone git@github.com:the-road-to-learn-react/react-autosave-example.git
  • cd react-autosave-example
  • npm install
  • npm start
  • visit http://localhost:3000

About

Autosave on a Form for React by Example

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published