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
Suppose I want to set the value for a model prop or session. How do I detect what is the valid dataType for that attribute?
This is useful when getting e.target.value from inputs, and when type='number' it will fail validation due to the required type being a number. Thus what you should use is e.target.valueAsNumber but you have no way of knowing ahead what is the required data type.
So either model.set should handle the type coercion, or you should be able to somehow determine programmatically the required type and coerce it yourself (something like model.getPropType('amount') --> 'number')
The text was updated successfully, but these errors were encountered:
Suppose I want to set the value for a model
prop
orsession
. How do I detect what is the valid dataType for that attribute?This is useful when getting
e.target.value
from inputs, and whentype='number'
it will fail validation due to the required type being a number. Thus what you should use ise.target.valueAsNumber
but you have no way of knowing ahead what is the required data type.So either
model.set
should handle the type coercion, or you should be able to somehow determine programmatically the required type and coerce it yourself (something likemodel.getPropType('amount') --> 'number'
)The text was updated successfully, but these errors were encountered: