Component
Component
A reusable piece of the screen, like a button or a card, that you build once and use in many places.
💡 It's a LEGO brick. You snap the same brick in wherever you need it.
🤖 Say this to your AI
Turn the product card into a component. It should take an image, name, and price (as props), and be used on both the home page and the search results page.
The key word is ‘Component’. Including it helps AI understand you much more precisely.
📌 Good to know
Values you pass into a component are called 'props'. Values a component remembers on its own are called 'state'.
When to use it
- When the same design repeats across several pages
- When you want one change to update it everywhere
Also called: reusable part, ui piece, building block, props, state, widget, module