Open rajoriaakash opened 3 years ago
But why would I need to declare onSelect when it's already declared?
Well if it is already declared then just make sure to extend the declaration by an arrow function outside the JSX attribute. The problem with having functions declared inside JSX is that it'll create a new function with every render. And if you just remove the arrow function that is declared and call onSelect(index)
directly, this will not be called when onSelect
is being triggered, but when it re-renders.
Tried to fix the issue #19