I need to implement a long list, each item in the long list will trigger a new function when onClick, because this function is unchanged every time it is rendered, so I want to use useCallback to optimize it, this returned function Fn needs to pass in parameters, so should I use bind to pass parameters in onClick?
const func = useCallback((num) => setIndex(num), [])
// myComponent
<TableItem onClick = { func.bind(null, index) } />
This is my first question, please forgive me if something is wrong,Thanks.