What do we use in React to pass data from a parent component to a child component?
- JavaScript functions
- Props
- React Router
- Redux
In React, "props" (short for properties) are a way of passing data from parent to child components. They are read-only and help in component communication. Functions, React Router, and Redux serve different purposes.
Loading...
Related Quiz
- When would you typically use a HOC in your React application?
- You're tasked with optimizing a Next.js application. The application has some pages that rarely change and others that need real-time data. How would you handle the rendering of these pages for optimal performance?
- While profiling a complex React application, you observe that a child component renders every time its parent renders, but the child's props haven't changed. What could you utilize to optimize the child component's re-renders?
- In React Transition Group, what prop is used to define the duration of an exit animation?
- You're building a modal dialog system for a web application. Which advanced React pattern would be best suited to render the modal outside the app's main DOM hierarchy, but control it from within a component?