Skip to content
Advertisement

Tag: react-router

React router not showing browser history

I’m learning from this tutorial but I keep getting this error: ‘react-router’ does not contain an export named ‘browserHistory’. The file that has react-router is this: Answer You need to get browserHistory from the history module now. Note that they changed the module API recently so if you are using the latest version the import slightly changed:

react router and express GET conflict

I’m not able to figure out how react router and express route working together. I have this The problem is my api can’t use GET because it will redirect to index.html. If I remove the wildcard route, then react-router would not be able to work properly. Answer Your app.get(‘*’) statement will match any request coming in. You can fix your

How to remove trailing slash in react-router URLs

I start to use react-router in my application and I am noting that when it has a trailing slash at end of URL (/url/) it does not work. I searched more about it, read all documentation and react-router issues and tried to use <Redirect from=’/*/’ to=”/*” />, however it was not a good solution, cause it did not work too.

react-router: How to disable a , if its active?

How can I disable a <Link> in react-router, if its URL already active? E.g. if my URL wouldn’t change on a click on <Link> I want to prevent clicking at all or render a <span> instead of a <Link>. The only solution which comes to my mind is using activeClassName (or activeStyle) and setting pointer-events: none;, but I’d rather like

Accessing Redux Store from routes set up via React Router

I would like to make use of react-router’s onEnter handler in order to prompt users to authenticate when entering a restricted route. So far my routes.js file looks something like this: Ideally, I’d like my requireAuth function to be a redux action that has access to the store and current state, that works like this: store.dispatch(requireAuth()). Unfortunately I don’t have

Advertisement