
React Key Concepts
By :

By now, you understand how to correctly set up event listeners and execute functions upon certain events. What's missing is a feature that forces React to update the visible UI on the screen and the content that is displayed to the app users.
That's where React's state concept comes into play. Like props, state is a key concept of React, but whereas props are about receiving external data inside a component, state is about managing and updating internal data. And, most importantly, whenever such state is updated, React goes ahead and updates the parts of the UI that are affected by the state change.
Here's how state is used in React (of course, the code will then be explained in detail afterward):
import { useState } from 'react';
function EmailInput() {
const [errorMessage, setErrorMessage] = useState('');
function evaluateEmail(event) {
const enteredEmail = event.target.value;
if (enteredEmail.trim() === '...