DEV Community

Discussion on: `onClick` listener to be a function, instead got a value of `object` type.

arberbr profile image
Arber Braja • Edited

First of all I dont think is the right place for solving your programming issues.

There are places much more suitable for this.

Secondly you are doing it wrong.

You should provide the onClick event listener a correct event handler, a function. Then encapsulate inside this event handler function whatever logic you want to do. Either return a value from this function or if directly inside the function re-assign url using window.location.assign to whatever value you need to set there.