User_Targaryen User_Targaryen - 3 months ago 9
React JSX Question

Can Proptypes Number in React take Float?

Can optionalNumber be a floating point number in this case?

optionalNumber: React.PropTypes.number

Answer

React.PropTypes.number is performing a typeof check against 'number' so any number (1, .1, 1e-3, Infinity, NaN) will pass.

Comments