Practicing Typescript: Extracting a Components Prop Types

zenoan·2021년 12월 22일
0

typescript

목록 보기
10/11

Extract components props types

  • Reuse the types from an existing component
import React from 'react'
import { Greet } from '../props/Greet'

export const CustomComponent = (props: React.ComponentProps<typeof Greet>) => {
  return <div>{props.name}</div>
}
profile
프론트엔드 개발자

0개의 댓글