'reach' router typescript code example
Example 1: how to install react router dom with typescript
npm install react-router-dom @types/react-router-dom
# Yarn
yarn add react-router-dom @types/react-router-dom
Example 2: reach router path typescript error
import React, { FunctionComponent } from "react";
import { RouteComponentProps } from "@reach/router";
type Props = { component: FunctionComponent } & RouteComponentProps;
const Route: FunctionComponent<Props> = ({ component: Component, ...rest }) => (
<Component {...rest} />
);
export default Route;