Default Props

suggest change

defaultProps sets default values for props. In the example below, if you do not pass the name prop, it displays John. Otherwise it displays 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