index.tsx 495 B

1234567891011121314151617181920212223
  1. import { Recipe } from '@/types/recipes';
  2. import { FunctionComponent, FC } from 'react';
  3. import styles from './RecipeItem.module.css';
  4. type RecipeItemProps = {
  5. tagName?: keyof JSX.IntrinsicElements,
  6. recipe: Recipe
  7. };
  8. export const RecipeItem: FC<RecipeItemProps> = ({ tagName, recipe }) => {
  9. const Tag = tagName as keyof JSX.IntrinsicElements;
  10. return (
  11. <Tag>
  12. <h3>{recipe.name}</h3>
  13. </Tag>
  14. )
  15. }
  16. RecipeItem.defaultProps = {
  17. tagName: 'div',
  18. };
  19. export default RecipeItem;