W3Reference.com
Toggle Menu
Home
Online Rust Compiler
Tutorials
Python Tutorial
Java Tutorial
Rust Tutorial
TypeScript Tutorial
ReactJS Tutorial
HTML & CSS Basics
Docker Containers Guide
Kubernetes Tutorial
Software Design Patterns
Blog
All Posts
ReactJS Fundamentals
Test your understanding of components,props,and state management.
1. What is JSX in React?
A templating language similar to HTML
A JavaScript syntax extension for creating UI elements
A separate programming language for React
A CSS preprocessor
2. Which of the following are valid React hooks (select all that apply)?
useState
useEffect
useRender
useContext
useClass
3. React uses a Virtual DOM to improve performance.
True
False
4. What does the acronym 'JSX' stand for?
5. Which React component type is recommended for most use cases in modern React?
Class components
Functional components with hooks
Stateless components
Pure components
6. Which of the following are true about React props? (select all that apply)
Props are read-only
Props can be modified by the child component
Props are passed from parent to child
Props are used to manage component state
Props can have default values
7. In React, 'setState' updates the state immediately.
True
False
8. What hook is used to add state to functional components? (full name)
9. What is the purpose of the 'key' prop in React lists?
To style list items
To uniquely identify items for efficient re-rendering
To sort list items
To handle click events on list items
10. Which lifecycle methods are available in class components? (select all that apply)
componentDidMount
useEffect
componentDidUpdate
componentWillUnmount
useState
11. React is a framework, not a library.
True
False
12. What does 'DOM' stand for in the context of web development?
13. Which of the following is a valid way to render a React component?
ReactDOM.render(<App />, document.getElementById('root'))
React.render(<App />, root)
App.render()
document.render(<App />)
14. Which of the following are features of React? (select all that apply)
Declarative
Component-based
Imperative
Virtual DOM
Two-way data binding by default
15. Functional components can use state with the help of hooks.
True
False
16. What is the name of the component that allows returning multiple elements without a wrapper div?
17. What is the difference between state and props in React?
State is read-only, props are mutable
State is for parent components, props for children
State is internal to a component, props are passed from parent
State is used in class components, props in functional
18. Which hooks can be used to perform side effects in functional components? (select all that apply)
useEffect
useState
useLayoutEffect
useRef
useEffectCleanup
19. JSX allows embedding any JavaScript expression inside curly braces {}.
True
False
20. What is the term for a component that accepts 'children' as a prop to wrap other elements?
Reset
Answered 0 of 0 — 0 correct