How do you pass data from a parent component to a child component in React?
Using state
Using refs
Using props
Using events
In JSX, how would you set the 'class' attribute for an element?
In React, what is the primary method for handling events in functional components?
Using inline event handlers like onClick={handleClick}
onClick={handleClick}
Defining separate event handler methods within the component
Using the addEventListener method like in vanilla JavaScript
addEventListener
React components don't handle events directly; you must use a library.
What happens if a prop is not provided to a component with a default prop defined?
The component will not render
The prop will be undefined
An error is thrown
The default prop value is used
How do class components in React typically handle events?
Class components cannot handle events; only functional components can
Using inline arrow functions directly in the JSX
By relying on external state management libraries for event handling
By defining methods on the class that act as event handlers
What is the typical approach for handling form submission in React?
Using a third-party library to handle all form-related tasks.
Using the browser's default form submission mechanism.
Submitting the form using AJAX without any event handling.
Preventing default behavior and handling submission logic within an event handler.
When would it be more appropriate to consider using an uncontrolled component in a React form?
When you need real-time validation and immediate feedback to the user.
When dealing with a large, complex form where performance optimization is critical.
When you prefer a more imperative approach and direct DOM manipulation.
When integrating with a third-party library that requires direct access to form elements.
How can you display validation errors to the user in a React form?
By conditionally rendering error messages based on validation results.
By using browser alerts to notify the user of invalid input.
By relying solely on HTML5's built-in validation error messages.
By logging errors to the console for debugging purposes.
Which of the following JSX expressions is INVALID?
<span>This is incorrect {</span>
How do you represent an empty tag in JSX, like an <img> tag?
<img></img>
<img></>