score:2
According to this reply, https://github.com/ReactTraining/react-router/issues/820#issuecomment-256814655
Using hooks (onEnter and onChange)
with react-router
v2 or above may achieve what you need.
score:0
Better resolve the problem from web server, like Nginx, which rewrites the url to add the trailing slash at the end of url.
score:1
Above answer will work fine and you will achieve what you need. But there is a catch. Open developers tool and click on network tab then refresh your page....you will see status 302 page redirect from WITHOUT trailing slash path to WITH trailing slash path.
And this is not very good. Atleast set status to 301.
How to set status ? https://github.com/ReactTraining/react-router/issues/458
Source: stackoverflow.com
Related Query
- how to add slash in react router path
- How can I add multiple path for home page with react router dom 6?
- How to navigate on path by button click in react router v4?
- How to add login authentication and session to ReactJS React Router and Redux with MongoDB + NodeJS Express?
- How to add dynamic code inside of a React Router Link component
- How to add more than one Outlet component react router dom V6?
- React router dom - Link. How can I put an ID into the path of Link
- How to add hash to url with React Router without rerendering?
- How to match ambiguous path and static path with React Router
- How can i use param in path as prop react router dom v6
- How to add Link from react router dom to the submit button with the default Submit validation
- How to setup React Router in a sub folder with an ambiguous path
- How to make path param to be optional in react router dom(v4)?
- How to pass id in path url as component property in react router v6
- How to get React Router to recognize a new route on a dynamic path
- How to add Navbar and a Sidebar inside the React Router v6 Routes?
- react router 4 - how to make a root path with nested routes but fallback to not-found
- How to get previous path in react router 4
- How add types for react private router component?
- React Router v6 : How to render multiple component inside and outside a div with the same path
- React Router Dom doesn't redirect to specified path on entering of wrong path after handling that. How do I fix it?
- React router v6: how to get relative index path in component?
- How to use path in react Router Route for the following format
- React router v6: How to ignore beginning path and evaluate the rest of it
- How to redirect / path into /app in react router 6?
- How do you write nested routes after dynamic path in React Router v5.2?
- React router - How to redirect to child component if parent component path is entered in url
- How can i remove a Property from a react component on router path change
- How to Make React Router Resolve within a nested path
- How can I get the correct current path in React using react router 4.2.2's withRouter?
More Query from same tag
- React reading data form the server
- How to style the dropdown UI in the basic html select element in React?
- Howto get bootstrap grid row or grid container width in pixels by javascript
- React router history push is ignored by browser back button
- crop image in reactjs using html5 canvas
- Navigate to a different route programmatically
- Append data in same page in button click with react Js
- How to handle multiple controlled inputs with react es6?
- Wrong width for React Slick Slider in Responsive View
- Redux-Thunk getStore() doesn't retain state. Returning 'undefined'
- How to render a option of select element - reactjs
- Understanding of how to use mapDispatchToProps in react-redux?
- React maintain focus position after clicking on different element
- In react how to convert html tags to display inside the htmleditor
- React - How do I handle checkbox data correctly
- React - Remove item from array using its name / value
- Load more data on scroll
- How to avoid nested ternary operators
- React - Pass form data into a function
- Can't perform a React state update on an unmounted component and states are not getting updated
- How to fix "send action after loading, problem with loop"
- Firebase realtime database - filtering query not on client side Web/React
- How to make a dropdown menu open below the Appbar using Material-UI?
- I want to use my form inputs to set origin and destination
- Load Images in map function dynamic
- Modify an HTML element from one component in another component in React.js
- Prevent web pack from bundling react
- My reducer returns undefined as if it wasn't added into combineReducers, but it is
- Asynchronous state with input in react
- Rendering an object into a table in React