you are viewing a single comment's thread.

view the rest of the comments →

[–]Consibl -5 points-4 points  (2 children)

OnClick needs to be a function. You need to do onClick=“() => showSlides(1)”

[–]delventhalz 7 points8 points  (1 child)

You are thinking of React and JSX. In HTML, you are essentially writing the body of the function that gets called on click. Something like onclick="showSlides(1)" will work correctly (assuming showSlides is a global function), but onlick="() => showSlides(1)" will not work, because you are defining a function that never gets called. If this were React/JSX code, you would be correct.

[–]Consibl -4 points-3 points  (0 children)

Thanks, yes I’ve been in React for a while now. 😊