score:2

Accepted answer
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.4/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.4/umd/react-dom.production.min.js"></script>
<div id="root"></div>

score:0

const func = useCallback((num => setIndex(num)), [])
<Component onClick={()=>func(yourParam)}/>

Related Query

More Query from same tag