I am experimenting with styled-components and have seen that we can define a custom component easily such as:
const myButton = ({className, children}) => {
<button className={className}>{children}</button>
}
However when I am using it in the rendered HTML, I cannot seem to get an event to trigger from the onClick handler attached...
<MyButton onClick={doSomething}>My custom button element</MyButton>
I have also tried attaching onClick to the defined const, including the function in that file:
const myButton = ({className, children}) => {
<button className={className} onClick="{doSomething}">{children}</button>
}
But neither seem to work...