Which of the following is a common approach for implementing form validation in React?
Utilizing a dedicated form validation library.
All of the above.
Writing custom validation functions within the component.
Using HTML5 form validation attributes.
What is the purpose of the useState hook in React?
useState
To manage and update the state of a functional component
To fetch data from an API
To handle user input events
To style components dynamically
In JSX, how would you set the 'class' attribute for an element?
What is the primary purpose of components in React?
To handle user interactions
To directly manipulate the DOM
To break down the UI into independent, reusable pieces
To manage application state
How do you pass data from a parent component to a child component in React?
Using refs
Using state
Using events
Using props
What are Synthetic Events in React?
React's custom event objects that wrap native events
Events triggered only by synthetic user actions (like bot interactions)
Native browser events directly exposed by the DOM
Events related to state changes within a React component
What is the purpose of event.preventDefault() in React event handling?
event.preventDefault()
To prevent the default behavior of the event (like form submission)
To stop the event from bubbling up the component tree
To detach the event handler after it has been executed once
To cancel the event entirely and prevent any further actions
What are props in React?
Arguments passed to a component
Lifecycle methods of a component
Internal data of a component
Functions to update the UI
What is the primary role of 'Synthetic Events' in React?
To directly manipulate the DOM without using React's virtual DOM
To prevent default browser actions for all events
To enable asynchronous event handling in React components
To provide a cross-browser consistent interface for handling DOM events
When a component's state or props change, React decides whether to update the actual DOM. What is this process called?
State reconciliation
Lifecycle management
Virtual DOM diffing
Component rehydration