約368件1ページ目

日本語のみで絞り込む

2020/6/19 -I've actually built a helper function now that takes the existing props and a simple object that defines any default values and then returns it ...

2016/5/17 -The defaultProps has no explicit type annotation. Its type is inferred and used by the compiler to determine which JSX attributes are required.

Setting Greet.defaultProps = { age: 21 } will not work on function components in React 19 — the value is ignored at runtime and FunctionComponent no longer ...

2022/9/27 -Did you know that the default value of a prop could be computed dynamically, at call time? Yes, you can use a function to compute it. You can ...

2025/11/27 -I'm looking for a working & elegant solution to assign a default prop value to a React Native core component such as Text.

2026/1/7 -React's defaultProps are being phased out in favor of ES6 default parameters and destructuring defaults. This approach is more TypeScript- ...

2018/6/5 -Our Button s defaultProps are not typed at all, because type checker cannot infer types from generic class extentions definition to its static ...

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 ...

React props pass data between components, enabling reusability and customization. Learn syntax, default values, event handling, and best practices.

2021/10/10 -// Be sure to set the default props. FancyTitle.defaultProps = defaultProps;. export default FancyTitle;. That's it! Required, optional, and ...