import React, { useContext } from 'react'; import { Route, Switch, useRouteMatch } from 'react-router-dom'; import _ from 'lodash'; import ServiceList from './ServiceList'; import ServiceItem from './ServiceItem'; import ServiceContext from './ServiceContext'; const Service: React.FC = () => { const { path } = useRouteMatch(); const service = useContext(ServiceContext); return ( {_.map(service.routes, (component, route) => ( ))} ); }; export default Service;