If instead of using `routeLink` , I want to change...
# javascript
d
If instead of using
routeLink
, I want to change the url when I am clicking on a
td
element, what code should I use?
s
Something like
Copy code
td.attrs.onClick { e -> history.push(url) }
You can get the history from RouteResult and pass it down or maybe use something like
withRouter
but havent used it myself
d
thanks @spand how do I access history?
it doesn’t seems available
I did this:
Copy code
onClickFunction = { window.history.pushState(null, "", "/country/${props.item.encodedName}") }
the url gets updated on the browser, but the browerRouter is not picking up the change
ok, I found the way:
Copy code
val history = useHistory()
......
tr.attrs {
     onClickFunction = { history.push("/country/${props.item.encodedName}") }
}
d
Hi i got similiar problem. I am using hash router. When i click on a button in component i want to be redirected to that page. How can i do this ?