React Native
About Lesson

In this React Native lesson we are going to learn about React Native Props, so Props are short for properties and it is used to pass some value from one component to another component, or we can say using props we can feed some value from the parent component to the child component, you can use props in functional component and also class component, but remember that react props are immutable, it means that you can not change the value of the props once it is assigned.



First we are going to use functional component, this is my App.js and you can see that i have passed some value to my child component that is Hello.js.




Now we can access to this value in our Hello.js component using props, you need to pass props in your functional component as parameter and after that you can access to the values using that props.




First run this command 



This will be the result.

React Native Props
React Native Props




Props in Class Component

Also we can use props in class component, so this is my App.js file, and we have added a value to our child component, now we can access to this value in our class component using props.




This is our HelloClass.js file, now in a class component we don’t need to pass props as parameter, it is built in with our class and you can use this keyword to access to the props.





Run your application and this is the result.

React Native Props Class
React Native Props Class