0
0
React Nativemobile~5 mins

Props passing in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are props in React Native?
Props are inputs to React components. They are used to pass data from a parent component to a child component, like giving instructions or information.
Click to reveal answer
beginner
How do you pass a prop named title with value "Hello" to a component Greeting?
You write: <Greeting title="Hello" />. This sends the string "Hello" as the prop named title to the Greeting component.
Click to reveal answer
beginner
How does a child component access props in React Native?
The child component receives props as a function argument. For example: <code>function Greeting(props) { return &lt;Text&gt;{props.title}&lt;/Text&gt;; }</code>
Click to reveal answer
intermediate
Can props be changed inside the child component?
No, props are read-only. The child component should not modify props. If you want to change data, use state or pass new props from the parent.
Click to reveal answer
beginner
Why is props passing important in React Native?
Props allow components to be reusable and dynamic by letting parents send different data to children. This helps build flexible and organized apps.
Click to reveal answer
How do you pass a number prop named count with value 5 to a component Counter?
A<Counter count=5 />
B<Counter count={5} />
C<Counter count='5' />
D<Counter count="5" />
Where do props come from in a React Native app?
AFrom the parent component
BFrom the device hardware
CFrom the child component itself
DFrom the React Native library
Which of these is the correct way to access a prop named name inside a functional component?
Aprops.name
Bthis.props.name
Cstate.name
Dname.props
Can a child component modify the props it receives?
AOnly if you use useEffect
BYes, props are mutable
COnly if you use setState
DNo, props are read-only
What happens if you pass no props to a component expecting some?
AThe parent component crashes
BThe app crashes
CThe component uses default props or undefined values
DThe component automatically creates props
Explain how props are passed and used in React Native components.
Think about how you tell a friend what to do and how they listen.
You got /4 concepts.
    Describe why props passing helps make React Native apps reusable and organized.
    Imagine giving different instructions to the same toy to make it do different things.
    You got /4 concepts.