Promptles
Context

Specify Prop Contracts

When adding props to components, spell out the type, allowed values, whether it's required or optional, and the default. Ambiguous prop specs lead to mismatched interfaces between components.

Where you'll practice this

One Promptles scenario teaches this principle directly.

  • The Missing Prop

    You have a React component `UserCard.tsx` that displays a user's name and email. The design team wants you to add a `role` prop that shows a colored badge next to the name. The role can be "admin", "editor", or "viewer". It should be optional and default to "viewer". The project…

Other principles in Context