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
Note: These suggestions were initially proposed by @i-hardy on a now redundant Wiki page set-up following our migration to Typescript, this wiki page will be deleted however I'm saving the suggestions here as they may be conventions we want to apply?
Many of our components have prop type definitions named simply PropTypes, which can become confusing when working across files or when you need to import prop types. We can improve this by
a) Renaming the props type to something more explicit:
or b) For short props like this, inlining the types in the function:
We can also make it easier to spot unused props by destructuring the props object in the function- this also enables us to delete the defaultProps declaration:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Note: These suggestions were initially proposed by @i-hardy on a now redundant Wiki page set-up following our migration to Typescript, this wiki page will be deleted however I'm saving the suggestions here as they may be conventions we want to apply?
Many of our components have prop type definitions named simply
PropTypes
, which can become confusing when working across files or when you need to import prop types. We can improve this bya) Renaming the props type to something more explicit:
or b) For short props like this, inlining the types in the function:
We can also make it easier to spot unused props by destructuring the props object in the function- this also enables us to delete the
defaultProps
declaration:Beta Was this translation helpful? Give feedback.
All reactions