What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2022-03-02 17:55:02
defining component layout next ts
import { NextPage } from 'next' import { ComponentType, ReactElement, ReactNode } from 'react' export type Page<P = {}> = NextPage<P> & { // You can disable whichever you don't need getLayout?: (page: ReactElement) => ReactNode l... Add solution -
TypeScript 2022-02-28 04:10:01
ts react props type
// Declare the type of the props type CarProps = { name: string; brand: string; price; } // usage 1 const Car: React.FC<CarProps> = (props) => { const { name, brand, price } = props; // some logic } // usage 2 const Car: React.FC<C... Add solution -
TypeScript 2022-01-29 02:05:11
react typescript pass component as prop
interface ParentCompProps { childComp?: React.ReactNode; } const ChildComp: React.FC = () => <h2>This is a child component</h2> const ParentComp: React.FC<ParentCompProps> = (props) => { const { childComp } = props; return... Add solution