Detect URL change


I would like to trigger a function on each URL change. Basically, on the change.

What is the best way to achieve this in Frontity? Is there any preferred or native Frontity way?


When the url changes, changes. You can take advantage of useEffect for this. Something like:

useEffect(() => {
  //Do something
}, [])

You can place that in the index file of your components folder or in any other file where you are connected to state. It just depends on what you want to do.

Hope that helps.

Thank you for the answer. Yes, that’s what I did at the end.