← All React exercises

React implementation · 10

Phone number input

StatusNot taken

Problem

Create a PhoneNumberInput component. only accepts numerical digits format the number automatically as (123)456-7890 by adding the parenthesis when the 4th digit is entered also adding - before 7th digit You can use the default text input without any styling. Follow-up What if user removes some digits in the middle, does caret jumps to the end in your approach? caret position is not covered in our tests.

Solution

No solution file is included for this exercise yet.

Use the problem as an open implementation prompt, then compare your reasoning with the linked React documentation.