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
I was recently working on a component that had a button, and I wanted to make sure that consumers of the component passed a string for the button's aria-label. I am currently using propTypes.string.isRequired, but that is satisfied with an empty string (''). I checked the prop-types documentation, and was disappointed there was no propTypes.string.isNotEmpty.
I realize that an empty string is still a string, and that checking the value of the string is more validation than type-checking. I also realize that it is not difficult to write a custom propType, and that there are 3rd-party propType packages available.
Has this specific topic (propTypes.string.isNotEmpty) ever been publicly discussed as a candidate for prop-types? If so, will you please refer me to any documentation from those previous discussions?
The text was updated successfully, but these errors were encountered:
I was recently working on a component that had a button, and I wanted to make sure that consumers of the component passed a string for the button's
aria-label
. I am currently usingpropTypes.string.isRequired
, but that is satisfied with an empty string (''
). I checked theprop-types
documentation, and was disappointed there was nopropTypes.string.isNotEmpty
.I realize that an empty string is still a string, and that checking the value of the string is more validation than type-checking. I also realize that it is not difficult to write a custom
propType
, and that there are 3rd-partypropType
packages available.Has this specific topic (
propTypes.string.isNotEmpty
) ever been publicly discussed as a candidate forprop-types
? If so, will you please refer me to any documentation from those previous discussions?The text was updated successfully, but these errors were encountered: