You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When created reusable components, it is often very helpful to pass default props to the component.
Adding props to interface MuiStyledOptions will allow the users to set these props.
Examples
One use case:
Creating a reusable outlined button with extra css.
Instead of doing:
Hey @aqeelat, thanks for your interest. For your use case, I recommend creating your own wrapper component to apply default props, something like this:
Summary
When created reusable components, it is often very helpful to pass default props to the component.
Adding
props
tointerface MuiStyledOptions
will allow the users to set these props.Examples
One use case:
Creating a reusable outlined button with extra css.
Instead of doing:
and always remembering to add the variant when using the component, we can do this:
I know the css here is generic but the possibilities are endless
Motivation
Improving DX when creating reusable components, and minimizing human error
Search keywords: props defaults custom
The text was updated successfully, but these errors were encountered: