React – Rerender a class component after the window pathname change

Greeting guys, I have an issue with a class component (that handle a list), the first time I mount the component works without any issue showcasing the expected values, unfortunately when I change the pathname while inside the class component it doesn’t updated.

render() {
        const service = this.state.services.find(service => service.link === window.location.pathname)
        if (service) {
            return <Service {...service} />
        }
      }

I would like to know if there is something to keep track of windows pathname in real time and maybe use the forceUpdate(); to refresh the component.

let me know if you need more information!