javascript - Retrieve back navigation action from react router -
in application i'm building chose react-router handle navigation flow, need track event of navigating on browser, when try load component in new render need know if user has landed here pressing button. best way track it? i'm pretty sure using history api, couldn't find straight way check that, , feels should pretty easy given how library works.
anyone shed light on matter welcomed! thanks!
you're correct! react-router uses html5 history api, explained in docs here (https://github.com/rackt/react-router/blob/master/docs/api.md#histories) you'll need import 'browser history' package , pass router, documented here (https://github.com/rackt/react-router/blob/master/docs/guides/basics/histories.md#browserhistory).
there example in doc's how go implementing here (https://github.com/rackt/react-router/blob/master/docs/guides/basics/histories.md#example-implementation)
Comments
Post a Comment