React Native Classroom image

Rajendra  Kumar / Professional / Mobile Technology

To post your Question Join Classroom
Lesson Topics's No:-  |1 | 2 | 3 | 4|Last
Lessons:-React Native – Props

React Native – Props

In our last chapter, we showed you how to use mutable state. In this chapter, we will show you how to combine the state and the props.

Presentational components should get all data by passing props. Only container components should have state.

Container Component

We will now understand what a container compenent is and also how it works.


Now we will update our container component. This component will handle the state and pass the props to the presentational component.

Container component is only used for handling state. All functionality related to view (styling etc.) will be handled in the presentational component.


If we want to use example from the last chapter we need to remove the Text element from the render function since this element is used for presenting text to the users. This
should be inside the presentational component.

Let us review the code in the example given below. We will import the PresentationalComponent and pass it to the render function.

After we import the PresentationalComponent and pass it to the render function, we need to pass the props. We will pass the props by adding myText = {this.state.myText} and deleteText = {this.deleteText} to <PresentationalComponent>. Now, we will be able to access this inside the presentational component.





Rajendra  Kumar

Skills    React Native

Qualifications :-
Location :-Delhi,Delhi,Delhi,India

I have more then 5 year of Mobile App Development Experience and have worked in Android Native, IOs with Swift,Ionic frameworks.



  Students (0)