ReactJS Viva Questions Answers
ReactJS Viva Questions Answers
1. What is React.js?
Answer: React.js is a JavaScript library developed by Facebook for building user interfaces,
Answer: JSX, Virtual DOM, Component-based architecture, One-way data binding, and
performance optimizations.
Answer: The virtual DOM is a lightweight copy of the real DOM. React updates the virtual DOM
first, compares it with the previous version, and efficiently updates only the changed parts in the real
DOM.
4. What is JSX?
Answer: JSX stands for JavaScript XML. It allows writing HTML elements in JavaScript and
Answer: Components are the building blocks of a React application. They split the UI into
Answer: Functional components are stateless and use hooks. Class components are ES6 classes
Answer: useState allows functional components to have state. It returns a stateful value and a
Answer: Data is passed using props. The parent component sends data as attributes to the child
component.
Answer: Props are used to pass data and event handlers to components. They are read-only and
Answer: State is managed within the component, while props are passed to the component. State
12. What is prop drilling, and how can you avoid it?
Answer: Prop drilling is passing props through multiple levels. It can be avoided using Context API
Answer: Controlled components have form data controlled by React state. Uncontrolled
componentWillUnmount.
Answer: Using JavaScript operators like if-else, ternary operator, or logical && to conditionally
render elements.
Answer: Using event handlers like onSubmit, along with controlled components to manage form
state.
Answer: Using techniques like code-splitting, memoization, lazy loading, and avoiding
unnecessary re-renders.
Answer: It is a technique to split code into smaller bundles, which can be loaded on demand,
improving performance.
19. What is Context API, and when would you use it?
Answer: The Context API is used for sharing state across components without prop drilling.
20. What are keys in React, and why are they important?
Answer: Keys help React identify which items have changed, are added, or are removed. They
Answer: By regularly following the course, completing assignments, and revising concepts with
hands-on coding.
22. What was the most challenging topic during the course?
Answer: Understanding the useEffect hook and managing side effects properly.
23. Can you describe a small project or task you did during the course?
Answer: I built a to-do list app with add, delete, and filter functionalities using functional
24. What did you learn about yourself through this course?
Answer: That I enjoy building UI and learning through structured online content.
Answer: I plan to use it in my frontend development projects and explore full-stack development