react native - How to do a Prototype validation -


my eslint ( airbnb ), tells me need prototype validation, googled , couldn't find out how in react-native. ? thank you

something this if you're using es6 classes correct way define proptypes shown in react docs:

export class counter extends react.component {   constructor(props) {     super(props);     this.state = {count: props.initialcount};   }   tick() {     this.setstate({count: this.state.count + 1});   }   render() {     return (       <div onclick={this.tick.bind(this)}>         clicks: {this.state.count}       </div>     );   } } counter.proptypes = { initialcount: react.proptypes.number }; counter.defaultprops = { initialcount: 0 } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -