Default Props

suggest change

defaultProps allows you to set default prop values for your component. In the below example if you do not pass the name props, it will display John otherwise it will display the passed value

class Example extends Component {
  render() {
    return (
      <View>
        <Text>{this.props.name}</Text>
      </View>
    )
  }
}
Example.defaultProps = {
  name: 'John'
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents