const handleBlur = ({ target }) => { const result = required(target.value); setValidationErrors({ ...validationErrors, firstName: result }); };
There are two important things to know about the code snippets that appear in this book.
The first is that some code samples show modifications to existing sections of code. When this happens, the changed lines appear inbold, and the other lines are simply there to provide context:
The second is that, often, some code samples will skip lines in order to keep the context clear. When this occurs, you’ll see this marked by a line with three dots:
if (!anyErrors(validationResult)) { ... } else { setValidationErrors(validationResult); }
Sometimes this happens for function parameters too:
if (!anyErrors(validationResult)) { setSubmitting(true); const result = await window.fetch(...); setSubmitting(false); ... }