I am trying to render a button in a react-table column. If I refactor the button to its own component, it complains that it's not a function.
Top level (ExampleReactTable.js):
const handleClick = () => setIsOpen(true); const columns = getTableColumns(handleClick); Middle layer (getTableColumns.js):
Cell: () => <ExampleButton handleClick={() => handleClick()} /> Botton layer (ExampleButton.js):
const ExampleButton = handleClick => { console.log(handleClick); return ( <Box> <Button variation="text" onClick={() => handleClick()}> Click </Button> </Box> ); }; This errors out with handleClick is not a function.
If I don't refactor the button out, it works:
Cell: () => ( <Box> <Button variation="text" onClick={() => handleClick()}> Click </Button> </Box>)