0
0
Reactframework~5 mins

What are props in React - Quick Revision & Key Takeaways

Choose your learning style9 modes available
Recall & Review
beginner
What are props in React?
Props are inputs to React components. They are like function arguments that let you pass data from a parent component to a child component.
Click to reveal answer
beginner
How do you pass props to a React component?
You pass props by adding attributes to the component tag, like <MyComponent name="Alice" />. The child component receives them as an object.
Click to reveal answer
beginner
Can props be changed inside a React component?
No, props are read-only. A component should never modify its own props. To change data, use state or pass new props from the parent.
Click to reveal answer
beginner
Why are props important in React?
Props let components be reusable and dynamic by receiving different data. They help build a clear data flow from parent to child components.
Click to reveal answer
beginner
Example: How to access a prop named 'title' inside a functional component?
Inside the function, use props.title or use object destructuring like function MyComponent({ title }) { ... } to access the title prop.
Click to reveal answer
What does 'props' stand for in React?
AProperties passed to components
BPrivate variables inside components
CFunctions to update state
DCSS styles for components
Can a React component modify its own props?
ANo, props are read-only
BOnly if using useState
CYes, anytime
DOnly in class components
How do you pass a prop named 'color' with value 'blue' to a component?
A<Component color: 'blue' />
B<Component color={blue} />
C<Component color='blue' />
D<Component 'color'='blue' />
Inside a functional component, how do you access props?
AUsing context API only
BUsing this.props
CUsing state variable
DUsing props parameter or destructuring
Why are props useful in React?
ATo style components
BTo pass data and make components reusable
CTo store local state
DTo handle events only
Explain what props are in React and how they help components communicate.
Think about how you give instructions or data to a friend.
You got /4 concepts.
    Describe how to pass and access props in a functional React component with an example.
    Imagine sending a letter with a name on it and reading it inside.
    You got /4 concepts.