Validate a Single React Input

Share this video with your friends

Send Tweet

Learn to validate the presence of text in a single React input by displaying a green-check or a red-cross emoji next to it.

We'll do this by creating a variable isValid that will return true if any text is found in the state property hooked up to the input field. This newly created variable will be used in a ternary to display the correct emoji mentioned above.

Srinivas  Kasiriveni
Srinivas Kasiriveni
~ 6 years ago

How are you embedded to emoji ?

Gosha Arinich
Gosha Arinich(instructor)
~ 6 years ago

How are you embedded to emoji ?

The shortcut is cmd-ctrl-space on Mac