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 <Text>{props.title}</Text>; }</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" />
✗ Incorrect
Numbers must be passed inside curly braces in JSX. So count={5} passes the number 5, not a string.
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
✗ Incorrect
Props are passed down from parent components to child components to share data.
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
✗ Incorrect
In functional components, props are received as a parameter and accessed with props.name.
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
✗ Incorrect
Props are read-only and should never be changed by the child component.
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
✗ Incorrect
If no props are passed, the component may use default props or get undefined values, depending on how it is coded.
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.
Practice
(1/5)
1. What is the main purpose of props in React Native components?
easy
A. To style components with CSS
B. To store internal state of a component
C. To pass data from a parent component to a child component
D. To handle user input events
Solution
Step 1: Understand the role of props
Props are used to send data from a parent component down to its children, allowing dynamic content.
Step 2: Differentiate props from state and styling
State holds internal data, styling is separate, and event handling is done via callbacks, not props alone.
Final Answer:
To pass data from a parent component to a child component -> Option C
Quick Check:
Props = Data passing from parent to child [OK]
Hint: Props always flow from parent to child components [OK]
Common Mistakes:
Confusing props with state
Thinking props handle styling
Assuming props manage events directly
2. Which of the following is the correct way to pass a prop named title with value "Hello" to a component Greeting?
easy
A.
B.
C.
D.
Solution
Step 1: Recognize JSX prop syntax
Props with string values must be passed inside quotes like title="Hello".
Step 2: Identify incorrect syntax
Using curly braces without quotes expects a variable, missing quotes or equals sign is invalid.
Final Answer:
<Greeting title="Hello" /> -> Option A
Quick Check:
String props need quotes in JSX [OK]
Hint: Use quotes for string props in JSX [OK]
Common Mistakes:
Omitting quotes around string values
Using curly braces for plain strings
Missing equals sign between prop and value
3. What will be displayed on the screen when this code runs?
function Welcome(props) {
return {props.message};
}
export default function App() {
return ;
}
medium
A. props.message
B. Error: message not defined
C. Welcome
D. Hi there!
Solution
Step 1: Identify prop usage in Welcome component
The Welcome component receives message prop and displays it inside Text.
Step 2: Check what prop value is passed
The App component passes message="Hi there!" to Welcome.
Final Answer:
Hi there! -> Option D
Quick Check:
Props value shown in child component [OK]
Hint: Props values appear where used inside child components [OK]
Common Mistakes:
Printing the prop name instead of its value
Expecting component name to display
Assuming missing prop causes error
4. Identify the error in this code snippet:
function Button(props) {
return {props.label};
}
export default function App() {
return ;
}
medium
A. Missing quotes around string prop value
B. Incorrect component name
C. Text component cannot display props
D. Props cannot be passed to functional components
Solution
Step 1: Check prop syntax in App component
The prop label is passed as label=ClickMe without quotes, which is invalid for strings.
Step 2: Understand correct JSX prop passing
String values must be in quotes like label="ClickMe" or in curly braces if variable.
Final Answer:
Missing quotes around string prop value -> Option A
Quick Check:
String props need quotes in JSX [OK]
Hint: Always quote string props in JSX [OK]
Common Mistakes:
Forgetting quotes around string props
Thinking props can't be passed to functions
Misunderstanding Text component usage
5. You want to create a reusable Profile component that shows a user's name and age. Which of these is the best way to pass props to make it flexible?
hard
A.
B.
C.
D.
Solution
Step 1: Check prop value types and syntax
Strings like name should be in quotes; numbers like age should be passed as JavaScript expressions using curly braces.
Step 2: Evaluate each option
<Profile name="Alice" age={30} /> correctly passes name as string and age as number. <Profile name={"Alice"} age="30" /> passes age as string which is less ideal. <Profile name=Alice age=30 /> misses quotes and braces. <Profile name={Alice} age={30} /> uses undefined variable Alice.
Final Answer:
<Profile name="Alice" age={30} /> -> Option B
Quick Check:
Strings in quotes, numbers in braces [OK]
Hint: Use quotes for strings, braces for numbers in props [OK]
Common Mistakes:
Passing numbers as strings
Omitting quotes for strings
Using undefined variables without quotes
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.