Great question.
Overall itβs more inline with the rest of your react code.
1 problem with getElementById is that you can have multiples of the same ID. So if you have an input component with an ID of βfooβ, then that will display on the output multiple times.
Great example here.
Another advantage is that you can toss the reference to another component, which helps maintain your unidirectional data flow.
I can clearly see why now π. Thank you, Ruben π
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great question.
Overall itβs more inline with the rest of your react code.
1 problem with getElementById is that you can have multiples of the same ID. So if you have an input component with an ID of βfooβ, then that will display on the output multiple times.
Great example here.
Another advantage is that you can toss the reference to another component, which helps maintain your unidirectional data flow.
I can clearly see why now π.
Thank you, Ruben π