Skip to main content

Top 15 React Interview Questions for 1–2 Years Experience

🟦 Top 15 React Interview Questions for 1–2 Years Experience




Preparing for a React interview with 1–2 years of experience? Here's a carefully curated list of 15 important React questions with clear, real-world answers. These are frequently asked in interviews at companies like TCS, Infosys, Cognizant, Capgemini, and product-based firms.


Q1. What is the Virtual DOM in React, and how does it improve performance?

Answer: The Virtual DOM is a lightweight, in-memory copy of the real DOM. When state/props change, React creates a new Virtual DOM tree, compares it with the old one (diffing), and only updates the parts of the real DOM that changed. This makes rendering much faster and improves performance in large applications.

Q2. What is JSX in React?

Answer: JSX stands for JavaScript XML. It allows us to write HTML elements in JavaScript and place them in the DOM without using createElement(). JSX improves code readability and is transpiled to React.createElement() calls.

Q3. What are components in React?

Answer: Components are reusable, independent building blocks of UI in React. They can be function-based (functional components) or class-based. They accept input (props) and return React elements that describe the UI.

Q4. What is the difference between state and props?

Props: Read-only data passed from parent to child.
State: Data maintained inside a component. Can be updated using useState or this.setState().

Q5. What is the useEffect hook?

Answer: useEffect is a React hook that lets you perform side effects like data fetching, subscriptions, or manual DOM manipulations. It runs after render and can be configured to run on specific state/prop changes.

Q6. What is the difference between controlled and uncontrolled components?

Controlled: React controls the form input via state.
Uncontrolled: DOM manages the input internally using refs.

Q7. What is lifting state up in React?

Answer: When two or more components need to share data, we move the shared state to their closest common ancestor. This approach is called "lifting state up" and ensures one source of truth.

Q8. What is React Fragment?

Answer: <React.Fragment> or <> lets you group multiple elements without adding extra nodes to the DOM.

Q9. What are keys in React?

Answer: Keys help React identify which items have changed, are added, or removed. They should be unique and stable identifiers (like IDs).

Q10. What is prop drilling?

Answer: Prop drilling is passing props through intermediate components to reach a deeply nested component. It can be avoided using Context API or state management libraries.

Q11. What is React Context API?

Answer: Context API is a way to share values like theme, user, language across components without passing props manually at every level.

Q12. What is useRef in React?

Answer: useRef creates a mutable ref object that can hold a value that doesn't trigger re-renders. Often used to access DOM elements or keep values between renders.

Q13. What is memoization in React?

Answer: Memoization is the optimization technique of caching expensive function results. React provides React.memo and useMemo to avoid unnecessary re-renders and improve performance.

Q14. What is reconciliation in React?

Answer: Reconciliation is the process of comparing the current Virtual DOM with the previous one and applying only the necessary changes to the real DOM.

Q15. What is the difference between React and React Native?

Answer: React is used for building web applications. React Native is used to build mobile applications using the same React concepts but with native components (like View, Text instead of div, span).


✅ Final Tips:

  • Revise hooks and lifecycle patterns
  • Focus on real-world component structure and data flow
  • Be ready to write small component logic during interviews

📅 Last Updated: 15 May 2025
📎 #ReactInterview #ReactHooks #ReactQnA #1YearExperience

Comments

Popular posts from this blog

TCS Java Interview | Java | Spring Boot | Microservices | Database

TCS Java Interview | Java | Spring Boot | Microservices | Database This post is based on a Java backend developer interview simulation and provides direct transcript-based answers to help you prepare for similar interviews. 📺 This interview scenario was inspired by a video from the  YouTube channel:  CloudTech . 🔗 Watch the full video here:  https://www.youtube.com/watch?v=yVj2EgwZxk4 1. Can you introduce yourself and talk about your tech stack and domains? I have around 4.5 years of experience working as a Java developer. My core expertise is in Java and developing REST APIs using Spring Boot. I also have basic knowledge of microservices architecture. On the database side, I work with SQL and Oracle. Additionally, I have exposure to UI technologies like Angular, HTML, and CSS, but they are secondary skills. My primary focus is backend Java development. 2. Which version of Java are you currently working on? We are currently using Java 8 but are in the process of upgr...

Top 20 Spring Boot Microservices Architecture Interview Questions (With Speakable Answers)

Top 20 Spring Boot Microservices Architecture Interview Questions (With Speakable Answers) * * * 1. What is Microservices Architecture?   → Microservices architecture breaks an application into small, independent services. Each one handles a specific business function and can be developed, deployed, and scaled independently. They usually communicate over REST APIs or messaging queues. * * * 2. How does Spring Boot help in building microservices?   → Spring Boot offers embedded servers, auto-configuration, starter templates, and production-ready tools. It works well with Spring Cloud to provide service discovery, config management, load balancing, and more. * * * 3. What are the core components in a microservices setup?   → Key components include:   ✓ API Gateway   ✓ Eureka (Service Discovery)   ✓ Config Server   ✓ Kafka or RabbitMQ   ✓ Circuit Breaker (like Resilience4j)   ✓ Centralized logging and monitoring (ELK, Prometheus) * * * 4. What i...

Top 15 Spring Boot Interview Questions and Answers – Real Examples (2025)

Top 15 Spring Boot Interview Questions – 2025 Spring Boot is one of the most demanded frameworks for Java backend development. Whether you're interviewing for TCS, Infosys, or a product-based company, these Spring Boot questions will help you prepare like a pro. Here are 15 questions with detailed explanations for developers with 1–2 years of experience. Q1. What is Spring Boot? Answer: Spring Boot is a Java-based open-source framework built on top of the Spring Framework. It helps developers create stand-alone, production-ready Spring applications with minimal configuration. Its key features include: Auto-configuration Embedded servers (Tomcat, Jetty) Starter dependencies Production-ready tools (Actuator, Metrics, etc.) Example: You can create a REST API within minutes by using @RestController and spring-boot-starter-web — no need for external web server deployment. Q2. What is the role of @SpringBootApplication annotation? Answer: This annotation i...