Skip to content
Advertisement

Styled Components with React – form onSubmit not working

So I wanted to make a Styled Components form component and then use it in a bigger react component. Problem is, when I wanted to attach an onSubmit, it didn’t really work. My Styled Components form component:

JavaScript

My react parent component:

JavaScript

I tried something like this:

JavaScript

And even something like this in my Styled Components component:

JavaScript

For now I made it work with this:

JavaScript

Advertisement

Answer

try this

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement