I know about the navigate hook but I need to control the route from window object that means it has to be a global function. In vuejs, it was easy like,
window.pushpath = function(path) { router.push("/"+path) }
how can i achieve this kind of behaviour in react? I cant use react hooks in js as it is forbidden to use react hooks without using it inside component.