Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Proptypes Number in React take Float?

Can optionalNumber be a floating point number in this case?

      optionalNumber: React.PropTypes.number
like image 649
User_Targaryen Avatar asked Aug 10 '16 15:08

User_Targaryen


1 Answers

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

like image 84
ryanjduffy Avatar answered Sep 18 '22 13:09

ryanjduffy