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
What does JSX ultimately get transpiled into?
HTML
CSS
JSON
Plain JavaScript
What is the primary role of 'Synthetic Events' in React?
To directly manipulate the DOM without using React's virtual DOM
To provide a cross-browser consistent interface for handling DOM events
To enable asynchronous event handling in React components
To prevent default browser actions for all events
How do uncontrolled components in React handle form data?
By storing the data in a global state management library.
By using refs to directly access and manage DOM values.
By relying on data binding between the form and component state.
By sending an HTTP request to the server on every input change.
What's a common way to bind event handlers in React class components?
Both 'Using bind in the constructor' and 'Using arrow functions in the render method'
bind
render
Calling addEventListener within the componentDidMount lifecycle method
addEventListener
componentDidMount
Using arrow functions in the render method
Using bind in the constructor
What will happen if you update the state directly in a class component instead of using this.setState()?
this.setState()
The component will re-render automatically
An error will be thrown
The application will crash
The state will be updated, but the component won't re-render
In a class component, how do you update the state?
Using the useState hook
By modifying this.props object
this.props
By calling this.setState({ new state })
this.setState({ new state })
Using this.state = { new state } directly
this.state = { new state }
What's the difference between JSX attributes and HTML attributes?
JSX attributes are used for styling, while HTML attributes are for functionality.
There is no difference, they are the same.
JSX attributes can only be strings, while HTML attributes can be any data type.
JSX attributes are written in camelCase, while HTML attributes are lowercase.
What is a key advantage of using a controlled component for a file input in React?
Simplified styling of the file input element.
Direct access to the file data in the component's state.
Improved browser compatibility for file uploads.
Automatic upload of the file to the server.
What are props in React?
Functions to update the UI
Internal data of a component
Arguments passed to a component
Lifecycle methods of a component