Which type of component in React is primarily used for presenting data and does not manage its own state?
Class Component
Higher-Order Component
State Component
Functional Component
How can you display validation errors to the user in a React form?
By using browser alerts to notify the user of invalid input.
By logging errors to the console for debugging purposes.
By conditionally rendering error messages based on validation results.
By relying solely on HTML5's built-in validation error messages.
How do class components in React typically handle events?
Using inline arrow functions directly in the JSX
Class components cannot handle events; only functional components can
By relying on external state management libraries for event handling
By defining methods on the class that act as event handlers
How do uncontrolled components in React handle form data?
By using refs to directly access and manage DOM values.
By storing the data in a global state management library.
By sending an HTTP request to the server on every input change.
By relying on data binding between the form and component state.
What happens if a prop is not provided to a component with a default prop defined?
The default prop value is used
The component will not render
The prop will be undefined
An error is thrown
How do you pass data from a parent component to a child component in React?
Using props
Using events
Using refs
Using state
What's the difference between JSX attributes and HTML attributes?
JSX attributes are written in camelCase, while HTML attributes are lowercase.
There is no difference, they are the same.
JSX attributes are used for styling, while HTML attributes are for functionality.
JSX attributes can only be strings, while HTML attributes can be any data type.
How can you access the element that triggered an event within a React event handler?
By passing the element as an argument to the event handler
Using this keyword inside the event handler
this
React doesn't provide a way to access the triggering element
As a property of the event object (e.g., event.target)
event.target
What is the purpose of form validation in React?
To automatically submit the form when all fields are filled.
To ensure data integrity and prevent invalid submissions.
To style form elements based on user input.
To send data to the server for validation.
How can you access the original DOM event object in a React event handler?
By directly using event.target or event.currentTarget
event.currentTarget
By using a ref to the DOM element and accessing its event listeners
React doesn't provide access to the original DOM event; it's completely abstracted.
Through the nativeEvent property of the synthetic event object
nativeEvent