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
Why the double function indirection? How exactly is that adding spaces? I'm guessing it's just a sample to say that if "value" prop is a function, it'll get called but store the value untransformed.
Would love some hints.
The text was updated successfully, but these errors were encountered:
@pkreipke Here's what I did to format as a US # (works in example app):
(lol github code tag fails on the block)
constformatPhoneNumber: string=phoneNumberString=>{//normalize string and remove all unnecessary charactersphoneNumberString=(''+phoneNumberString).replace(/[^\d]/g,"");//check if number length is at least 10, if longer strip off the end charactersif(phoneNumberString.length>=10){//reformat and return US phone numberreturnphoneNumberString.substring(0,10).replace(/(\d{3})(\d{3})(\d{4})/,"$1-$2-$3");}//let them keep typing in their phone numberreturnphoneNumberString}
In this example Formatting Inputs I'm confused by this line:
const formatPhoneNumber: string => string = (unformattedPhoneNumber) => ...;
Why the double function indirection? How exactly is that adding spaces? I'm guessing it's just a sample to say that if "value" prop is a function, it'll get called but store the value untransformed.
Would love some hints.
The text was updated successfully, but these errors were encountered: