Summary and Key Takeaways
- Props are a key React concept that makes components configurable and therefore reusable.
- Props are automatically collected and passed into component functions by React.
- You decide (on a per-component basis) whether you want to use the props data (an object) or not.
- Props are passed into components like attributes or, via the special
children
prop, between the opening and closing tags. - Since you are writing the code, it's up to you how you want to pass data via props. Between the tags or as attributes? A single grouped attribute or many single-value attributes? It's up to you.
What's Next?
Props allow you to make components configurable and reusable. Still, they are rather static. Data and therefore the UI output doesn't change. You can't react to user events like button clicks.
But the true power of React only becomes visible once you do add events (and reactions to them).
In the next chapter, you will learn how you can add event listeners...