Lets start with ID attribute in react js and here we have used ID attribute to access one of the element in react component. Actually in this IdComponent Component we are performing below operations :
When user focus on text field, then it will change the border color to Blue and background color to light black.
When user focus out of the text field, then it will reset the border color and border color to initial stage.
The Reusability Problem
The problem you'll encounter , when you are using same component more than once. Here's a demo of re-usability issue with ID attribute, when you try to create that same component multiple times. Tap through the input fields to see what happens. Here we have created multiple objects with the same ID.
Solution is Ref
This component using Ref attribute to overcome above issue.