-
Is it possible to override the logic to a component? For example, a Basic example with a standard non function Button(props: ButtonProps) {
const { onClick } = props
function customClick(event: React.MouseEventHandler<HTMLButtonElement> | undefined) {
// do something on any button click
console.log("Good job!")
// then perform original onClick if present
if (onClick) {
onClick(event)
}
}
return <button {...props} onClick={customClick} />
} |
Beta Was this translation helpful? Give feedback.
Answered by
gregberge
Mar 16, 2024
Replies: 1 comment
-
No it's not the goal of this library if you need to do that then you should use a functional component. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
d-henn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No it's not the goal of this library if you need to do that then you should use a functional component.