Created
April 30, 2018 12:05
-
-
Save oakfang/f00006dd0e0fd376f684b43cdb8076a9 to your computer and use it in GitHub Desktop.
Relative Routes with react-router v4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { withRouter, Route } from 'react-router-dom'; | |
const RelativeRoute = ({ match, path, ...props }) => <Route path={`${match.path}${path}`} {...props} />; | |
export default withRouter(RelativeRoute); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment