You write an object / class as code outside of an object or class. Think of this code as normal JavaScript:
import React from 'react';
const YourButton = () => (
<button onClick={yourFunction}>BACK</button>
)
function yourFunction(event) {
console.log('hello there')
}
You can also embed this function if you want to pass more arguments:
const YourButton = () => (
<button onClick={event => yourFunction(event, 'foo', 'bar')}>BACK</button>
)
However, in this situation, it is very often to transfer functions down from the parent, which can interact with the state, for example.
const YourButton = props => (
<button onClick={props.yourFunction}>BACK</button>
)
" const", let var, , .