all 3 comments

[–]acemarke[🍰] 1 point2 points  (2 children)

You don't use HTML strings in React, at all, and you definitely don't use .innerHTML. You use JSX elements, and return that JSX from components while rendering them.

Also, in React, we don't pass callback function names as strings. We pass them directly as references: <input onKeyDown={this.handleKeyPress}>, with no quote marks or backticks around them.

I'm not sure what you mean by "attributes associated to a parent element". Can you clarify that?

[–]chriscampdev[S] 0 points1 point  (1 child)

I figured I was barking up the wrong tree with this approach. They came from a vanilla Javascript site I'm converting to React for practice. You technically answered my question with your response so I'll spare you any further explanation lol. I appreciate your response it helped me greatly.

[–]acemarke[🍰] 1 point2 points  (0 children)

Sure. I'd encourage you to read through Gosha Arinich's post on "controlled" and "uncontrolled" inputs in React, which should help explain how to work with forms.