React 19 中 React.FC children 无法解构问题
React About 249 words原因
React 19中将不会再隐式包含children属性了。
为了能更加清晰的看到组件实际使用的参数,能所见即所得。
常规使用
export default function ComponentA({postList}: { postList: Post[] }) {
}
如需使用 children
在入参中显式的传入children参数
export default function ComponentB({children}: {children: ReactNode}) {
}
Views: 17 · Posted: 2025-12-09
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...