Instructor: 00:03 We have this simple React application with a name input. The value of that input is stored in the nameState variable, and it's passed down to the input component. The handleNameChange updates the nameState variable.
00:21 We want to prevent the user from typing any character that is not a letter or a space character into the input. We want to filter out all of the numbers and special characters. We don't want to have this as a possible value of the name.
00:40 To achieve that we'll go to the handleNameChange function, and create a new variable here called newName. Its value will be event, target, value. We use this new variable in the setName call, setName(newName).
00:59 To filter out the unwanted characters, we'll call replaceOnValue. We'll give it a regular expression pattern, and we'll replace every character that matches that pattern with an empty string, essentially removing that character.
01:15 We can now see that we can input a normal name value, but if we try to input something like a number or a special character, it's not being added at all, no matter where we try to add it.