larrymyers / react-mini-router

A minimal URL router for React.js
MIT License
282 stars 34 forks source link

Pre route hook #45

Closed killfish closed 9 years ago

killfish commented 9 years ago

Is there a pre route method to hook into? I would like to check if some form content on a page "is dirty/not saved" and alert the user if they click the browser back/forward button.

larrymyers commented 9 years ago

There currently aren't any pre/post hooks provided. You can certainly store user input in localStorage (or some other form of local browser storage), and use it as a cache, that way your application can restore the form input on back button, forward button, page reload, etc.