Re:Why I'm not a React Native developer
by vmarsy on Saturday August 19, 2017 @03:50PM
(#15055224)
Agreed, but you can't anticipate what another dev could write :)
Or if you pass down that `isConnected` down to a library where for some reason they assumed `null` should default to `true`
Of course it's very unlikely, but my point is you can't know all use cases of `this.state.isConnected` in advance on a large project so as you say it doesn't hurt to sanitize the input.
Re:Why I'm not a React Native developer
by mikeycgto on Saturday August 19, 2017 @05:48PM
(#15055810)
That's why there's PropTypes so you can define what type a given prop should be. An error is raised if a higher level component passes in a prop of an incorrect type.
Or if you pass down that `isConnected` down to a library where for some reason they assumed `null` should default to `true`
Of course it's very unlikely, but my point is you can't know all use cases of `this.state.isConnected` in advance on a large project so as you say it doesn't hurt to sanitize the input.