accounts-frontend/packages/app/containers/AuthFlowRoute.tsx
2020-05-24 02:08:24 +03:00

20 lines
533 B
TypeScript

import React from 'react';
import { Route, RouteProps } from 'react-router-dom';
import AuthFlowRouteContents from './AuthFlowRouteContents';
export default function AuthFlowRoute(props: RouteProps) {
const { component: Component, ...routeProps } = props;
if (!Component) {
throw new Error('props.component required');
}
return (
<Route
{...routeProps}
render={(routerProps) => <AuthFlowRouteContents routerProps={routerProps} component={Component} />}
/>
);
}