Validating and sanitizing users’ data in React
Validation is a process that ensures user data quality, integrity, and an appropriate format that’s expected for a system. You can never trust data provided by users of your application blindly. While we expect them to trust our code, we can’t reciprocate that trust by not guiding them on how our forms and form data should be treated.
Starting as a junior developer, the phrase Don’t ever believe a user would always do the right thing with your form will forever ring true. You can never trust user data as is. Data that comes from users has to be thoroughly scrutinized and cleaned and ensured it is in the desired format.
Forms fields are the open window into everything you might call the backend in web development. So, trusting user input without some rules in place could be detrimental to your sanity as a developer and to the healthy condition of your web application.
There are always standard-practice...