react.dev favicon

Passing Props to a Component – React

6
公开标注数
6
参与人数
2026-07-26 09:45:06
首次 Whisper

本页的公开 Whisper

划选高亮2026-07-26 16:09:06
原文高亮摘录
Use spread syntax with restraint.
Whisper 随想笔记
Yeah but when you have like 10 props it's just so tempting...
划选高亮2026-07-26 13:06:06
原文高亮摘录
props are the only argument to your component!
Whisper 随想笔记
Wait, so I can't pass multiple arguments to a component? Feels limiting.
划选高亮2026-07-26 12:57:06
原文高亮摘录
props are the only argument to your component!
Whisper 随想笔记
So props are basically just one big object? That simplifies things.
划选高亮2026-07-26 10:03:06
原文高亮摘录
Props are the information that you pass to a JSX tag.
Whisper 随想笔记
Every time I forget to pass a prop, my component just stares at me blankly.
划选高亮2026-07-26 09:54:06
原文高亮摘录
Props are the information that you pass to a JSX tag.
Whisper 随想笔记
Wait, so even className counts as a prop? I thought that was just HTML stuff.
划选高亮2026-07-26 09:45:06
原文高亮摘录
Props are the information that you pass to a JSX tag.
Whisper 随想笔记
So basically props are like the settings you give a component before it does its thing.

分享本页 Whisper

分享到 X
短链接
https://domwhisper.com/s/43f69f505491
嵌入代码
<iframe src="https://domwhisper.com/embed/43f69f505491" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>

看看大家在 react.dev 上讨论了什么

安装 DomWhisper,浏览网页时实时查看 whisper,也可以加入讨论。

获取插件