You can respond to events by declaring event handler functions inside your components:
function MyButton ( ) {
function handleClick ( ) {
alert ( 'You clicked me!' ) ;
}
return (
< button onClick = { handleClick } >
Click me
</ button >
) ;
}
Notice how onClick={handleClick}
has no parentheses at the end! Do not call the event handler function: you only need to pass it down. React will call your event handler when the user clicks the button.
status | not read | reprioritisations | ||
---|---|---|---|---|
last reprioritisation on | suggested re-reading day | |||
started reading on | finished reading on |