What is the dirty and pristine state?
dirty and pristine are form field states that show whether the user has changed the value.
- dirty - the user has changed the field's value at least once.
- pristine - the field's value remains the same as it was on initialization.
Example:
- The "email" field starts empty:
pristine. - The user typed something and then even deleted it: it is still
dirty, because the change already happened.
These states help determine whether, for example, the form needs to be saved or the user should be warned about unsaved changes.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.