Skip to main content

🌟 Latest React and Js interview Questions 2025

React , JavaScript and TypeScript Interview Questions

  1. Microtasks vs MacroTasks

    • What is the difference between Microtasks and Macrotasks in JavaScript’s event loop?
    • Can you give an example of code that executes as a Microtask vs a Macrotask?
  2. npm vs npx

    • What is the difference between npm and npx?
    • When would you use npx instead of npm?
  3. Class Components vs Function Components

    • How do class components differ from function components in React?
    • Which one is preferred in modern React and why?
  4. DOM vs Virtual DOM

    • What is the difference between the DOM and Virtual DOM in React?
    • How does React’s Virtual DOM improve performance?
  5. useMemo vs React.memo

    • What’s the difference between useMemo and React.memo?
    • Give a use case where you would use useMemo instead of React.memo.
  6. Higher-Order Components (HOCs)

    • What is a Higher-Order Component in React?
    • Can you explain a real-world use case for HOCs?
  7. Managing State in React

    • What are the different ways to manage state in a React app?
    • When would you choose Context API vs Redux for state management?
  8. useLayoutEffect

    • What is useLayoutEffect and how is it different from useEffect?
    • When should you use useLayoutEffect?
  9. useRef vs createRef

    • What’s the difference between useRef (hook) and createRef (class-based)?
    • Can refs cause memory leaks?
  10. React Hook Form

    • What is React Hook Form and why is it used?
    • How does it compare with Formik?
  11. Managing Data & Sending to API

    • How do you manage form data in React and send it to an API?
    • How would you handle API errors when submitting a form?
  12. 10 Text Boxes Form

    • If you have 10 text inputs in a form, how would you manage their state?
    • Would you use a single state object or multiple useState hooks? Why?
  13. Redux

    • What are the core principles of Redux?
    • Can you explain the flow of data in Redux with an example?
  14. Axios

    • Why do we use Axios instead of Fetch API?
    • How do you intercept requests and responses in Axios?
  15. useFormContext Hook

    • What is the purpose of useFormContext in React Hook Form?
    • How does it help with deeply nested forms?
  16. Routing in React

    • How does routing work in React using React Router?
    • Difference between BrowserRouter and MemoryRouter?
  17. Authentication & Authorization in React

    • How do you implement authentication and authorization in React?
    • How do you protect routes based on user roles?
  18. Callback Queue & Callback Functions

    • What is the callback queue in JavaScript’s event loop?
    • How do callback functions work in asynchronous code?
  19. Closures

    • What is a closure in JavaScript?
    • Can you give a practical example of a closure in React?
  20. any vs unknown (TypeScript)

    • What’s the difference between any and unknown in TypeScript?
    • Which one is safer and why?
  21. Tree Shaking in React

    • What is tree shaking and how does it help in React apps?
    • How can you ensure your code benefits from tree shaking?
  22. JS Memory Management & Garbage Collection

    • How does JavaScript manage memory?
    • What are memory leaks and how can they be avoided?
  23. Compound Component Pattern

    • What is the compound component pattern in React?
    • Can you give an example (like a Tab system)?
  24. WeakMap vs WeakSet

    • Difference between WeakMap and WeakSet?
    • Why are they useful for memory management?
  25. Shallow Copy vs Deep Copy

    • Difference between shallow copy and deep copy?
    • How would you create a deep copy in JavaScript?
  26. Promises & Error Handling

    • How do you handle errors in Promises?
    • Difference between .catch and try...catch with async/await?
  27. Map, Filter, Reduce

    • How do map, filter, and reduce differ?
    • Write an example of each.
  28. Debounce vs Throttle

    • What is the difference between debouncing and throttling?
    • Give a real-world scenario for each.
  29. useTransition (React 18)

    • What is useTransition in React?
    • How does it improve UI responsiveness?
  30. Phases in Functional Components

    • What are the different phases of a functional component lifecycle?
    • How do hooks replace lifecycle methods?
  31. Mounting & Unmounting

    • What happens during mounting and unmounting in React?
    • How can you perform cleanup on unmount?
  32. Methods in Class Components

    • What are lifecycle methods in class components?
    • How do they compare with hooks in functional components?
  33. BrowserRouter vs MemoryRouter

    • Difference between BrowserRouter and MemoryRouter?
    • When would you use MemoryRouter?
  34. Hydration in React

    • What is hydration in React?
    • Why is it important for SSR (Server-Side Rendering)?
  35. startTransition (React 18)

    • What is startTransition and how is it different from useTransition?
    • Can you give an example?
  36. Custom Hooks

    • What are custom hooks in React?
    • How do they improve reusability?
  37. Synthetic Events in React

    • What are synthetic events in React?
    • How are they different from native DOM events?
  38. Memory Leaks

    • What causes memory leaks in React or JavaScript?
    • How can you prevent them?
  39. Lazy Loading & Performance Optimization

    • How does lazy loading work in React?
    • What other techniques can optimize React performance?
  40. Calling Parent Function from Child

    • Can a child component call a parent’s function in React?
    • How would you implement it?
  41. Memory Leak in React/JS

    • What are common causes of memory leaks in React/JavaScript?
    • How do you detect and fix them? 

Comments

Popular posts from this blog

🚪 Part 9: API Gateway for .NET 8 Microservices (Ocelot & YARP)

Once you have multiple microservices (Products, Orders, Payments…), exposing each one directly to clients gets messy: Different base URLs Duplicated auth logic No unified rate limiting / caching Hard to evolve routes or aggregate data 👉 Enter the API Gateway — your single front door for all microservices. An API Gateway handles: ✅ Routing & path rewriting ✅ Load balancing, retries, circuit breakers ✅ Authentication & Authorization (JWT, OAuth2) ✅ Rate limiting & caching ✅ Aggregation (compose results from multiple services) In this post we’ll implement two strong options: Ocelot → config-driven, mature, DevOps-friendly YARP (Yet Another Reverse Proxy) → Microsoft’s code-first, extensible gateway ⚖️ Ocelot vs YARP — When to Choose Ocelot → JSON config, minimal C#, built-in QoS (rate limit, circuit breaker). Perfect for teams that like DevOps config-as-code. YARP → full C# control, middleware-friendly, can embed into broader apps (e.g. add dashb...

🌟 Dot net Microservices interview questions

Here is a comprehensive list of 200 .NET microservices coding questions covering all core microservices concepts and cross-cutting concerns relevant for designing, building, deploying, and maintaining .NET-based distributed systems. 🧩 A. Microservices Fundamentals (20) Build a microservice in .NET 8 that exposes a simple CRUD API. Implement communication between two microservices using REST. How would you design microservices for an e-commerce application? Create a microservice that handles user registration and login. How do you isolate domain logic in a microservice? How to apply the "Single Responsibility Principle" in microservices? Design a service registry/discovery mechanism using custom middleware. Implement a service that handles file uploads and metadata separately. Build a stateless microservice and explain its benefits. Implement health check endpoints in .NET 8. Demonstrate versioning in a microservice API. Add Swagger/OpenAPI support to your m...

🎯 C# and Dot net important concepts for interview

🧭 Comprehensive Guide to C# and .NET Concepts This post is your structured map of all major C# language features and the .NET ecosystem. Whether you're preparing for interviews, certifications, or aiming to become a senior .NET developer, this list provides a clear roadmap from fundamentals to advanced topics. 1. C# Language Fundamentals Syntax basics → identifiers, keywords, statements, operators, precedence Types → value types (structs), reference types (classes), nullable value types, records Variables & scope → local, fields, constants, readonly, ref/out/in Control flow → if, switch (pattern matching), loops (for/foreach/while/do), goto Methods → parameters (default/named), overloading, optional params, discards Strings & text → string, StringBuilder, interpolation, raw string literals, ReadOnlySpan<char> Arrays & collections → arrays, tuples, ranges/indices, List, Dictionary, HashSet, LinkedList Exceptions → try/catch/finally, throw, custom exceptions, hiera...