Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created May 17, 2024 21:47
Show Gist options
  • Save PaulieScanlon/10b7a8d7d726902a0ab0f3a005079c8f to your computer and use it in GitHub Desktop.
Save PaulieScanlon/10b7a8d7d726902a0ab0f3a005079c8f to your computer and use it in GitHub Desktop.
Example React component
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