Skip to content

Instantly share code, notes, and snippets.

@oakfang
Created April 30, 2018 12:05
Show Gist options
  • Save oakfang/f00006dd0e0fd376f684b43cdb8076a9 to your computer and use it in GitHub Desktop.
Save oakfang/f00006dd0e0fd376f684b43cdb8076a9 to your computer and use it in GitHub Desktop.
Relative Routes with react-router v4
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