Onclick function is looping when I\'ve using this function inside to the map function. How to resolve it?