Created
May 17, 2024 21:47
-
-
Save PaulieScanlon/10b7a8d7d726902a0ab0f3a005079c8f to your computer and use it in GitHub Desktop.
Example React component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { FunctionComponent } from 'react'; | |
import type { AnalyticsType } from '../../schema'; | |
type PickedProps = Pick<AnalyticsType, 'city' | 'country' | 'flag'>; | |
interface Props { | |
analyticsData: PickedProps[]; | |
} | |
const VisitorsList: FunctionComponent<Props> = ({ analyticsData }) => { | |
return ( | |
<ul> | |
{analyticsData.map((data: PickedProps) => { | |
const { city, country, flag } = data; | |
return <li>{`${city} | ${country} | ${flag}`}</li>; | |
})} | |
</ul> | |
); | |
}; | |
export default VisitorsList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment