Challenge your knowledge of key React concepts, terminology, and practical basics with this beginner-friendly quiz. Perfect for anyone curious about how React works in frontend development.
Which main purpose does React serve in web development?
Explanation: React is primarily used for building user interfaces in web applications. Managing databases and server-side logic are outside its main scope. Creating REST APIs is not a core use of React; backend frameworks handle that.
Which company originally developed and released React?
Explanation: React was developed by Facebook to improve their web app's UI. Google and Microsoft have their own frameworks, while Twitter did not develop React.
What is the typical file extension for a React component that contains JSX?
Explanation: .jsx is the common file extension for React components using JSX syntax. .js files may work, but .jsx signals JSX specifically. .json and .css are unrelated to React components.
Which React hook do you use to manage state within a functional component?
Explanation: useState is the primary hook for managing state in functional components. useRef is for mutable references, useMemo optimizes calculation, and useEffect handles side effects.
What does JSX stand for in React applications?
Explanation: JSX stands for JavaScript XML, a syntax extension allowing HTML-like code in React. The other options are either incorrect expansions or unrelated phrases.
Which hook do you use to perform side effects, such as data fetching, in a React component?
Explanation: useEffect handles side effects in React, like fetching data or updating the DOM. useMemo and useCallback optimize performance, and useReducer manages complex state.
What mechanism is primarily used to send data from a parent React component to a child?
Explanation: Props transfer data from parent to child components in React. State is local to components, hooks help manage state or logic, and context is for deeper, global data sharing.
What does the virtual DOM represent in a React application?
Explanation: The virtual DOM is an in-memory, lightweight copy of the real DOM. It helps React efficiently update interfaces. It is not a database, stylesheet collection, or a function.
Which JavaScript method is commonly used to render a list of items in React components?
Explanation: map() iterates over arrays and returns new elements for rendering lists in React. filter() and reduce() have different array-processing purposes; slice() extracts portions but does not map elements.
What keyword is used to define a component as a function in React?
Explanation: The function keyword creates function components in React. class is used for class components, new is for creating object instances, and struct is irrelevant in JavaScript.