約107件1ページ目

日本語のみで絞り込む

2023/4/24 -With TypeScript, all the props you want to pass to a component are supposedly required — by default. So, modifying <Icon /> 's dashboard prop to ...

2016/10/24 -I'm trying to create a stateless React component with optional props and defaultProps in Typescript (for a React Native project). This is ...

2020/6/19 -A dead-simple component that accepts up to 5 props, with 2 of those props being required. For the 3 optional props, default values are assigned.

Typing default props. Function components​. As of React 19, defaultProps is no longer supported on function components. Use destructuring defaults directly ...

2022/9/27 -If your optional property is a boolean and its default value is false , the calling code can be simplified. For example, if you have a Button ...

2022/12/20 -This button has the color prop instead of type . color has red as a default value. The button might've had the default value for a purpose. For ...

2026/1/7 -Master typing React props from basics to advanced patterns—required vs optional, defaults, unions, generics, and building self-documenting ...

2024/12/19 -It's nice in typescript, since you can just set that property of the interface as optional, so it defaults to undefined if not passed.

The default value is only used if the size prop is missing or if you pass size={undefined} . But if you pass size={null} or size={0} , the default value will ...

2026/5/11 -(?) You can make a prop optional using ? interface Props { name: string; age?: number; } const UserCard = ({ name, age }: Props) => { return ( <div> ...