Skip to content

Instantly share code, notes, and snippets.

@dschinkel
Created August 17, 2020 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dschinkel/c2000ffed6bb868fb41cb589131473b7 to your computer and use it in GitHub Desktop.
Save dschinkel/c2000ffed6bb868fb41cb589131473b7 to your computer and use it in GitHub Desktop.
Cookebook - React/TypeScript - React Router via Functional Component (unverified)
//source: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/17355
import { RouteComponentProps } from 'react-router-dom';
type MyProps = RouteComponentProps<{ id?: string }>
const CoolThing: React.FC<MyProps> = ({ match }) => {
const id = match.params.id;
return (
<div>Hopefully that helps!</div>
);
}
export default CoolThing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment