1.

What are Props and how is it used in React Native?

Answer»

Props are means to the PARAMETERS that are used for customizing the component when the component is being created or re-rendered. They are more like the argument which is passed to the React component.

Example

import React, {Component} from 'react';
import {View, Text} from 'react-native';
CLASS DefaultPropComponent extends Component {
   render() {
       return (
           <View&GT;
             <Text>
              {this.props.name}
            </Text>
          </View>
       )
   }
}
Demo.defaultProps = {
   name: 'BOB'
}

EXPORT default DefaultPropComponent;



Discussion

No Comment Found