Shai Kimchi Shai Kimchi - 1 month ago 9x
React JSX Question

How to navigate in ReactJs singlepage app without using Link?

In react, What is the equivalent of using a

in an onClick function?
I want to create a react component inside a single page app, When a user presses anywhere on the components DOM, it has the same as the
<a href >


You can simply put an onClick at the top of the document if you want. The click event will bubble using normal event rules and you can access to find the origin. From there you can call window.location.href = 'some-path' to emulate the experience.