react router - How do I access action and history from BrowserRouter in Matched route (v4)? -


i'm using react router v4 , using browserrouter.

enter image description here

this screenshot here shows browserrouter's props have action="pop".

enter image description here

however, when route matched in screenshot above, registermatch or matchprovider not receiving action, history, etc. via props.

i see via https://github.com/reacttraining/react-router/blob/v4/website/components/fakebrowser/index.js#l96 there might need injection of these props, i'm not able make sense of or make work.

using <router /> history prop or <browserrouter /> basename prop solves this. e.g. <router history={history}>

<browserrouter> ignores history prop. use custom history, ' + 'use import { router } instead of import { browserrouter router }.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -