React Js Frontend Developer

filter-iconFilter interviews by

300+ React Js Frontend Developer Interview Questions and Answers

Updated 5 Mar 2025

Popular Companies

search-icon

Q51. How does Server-Side Rendering work?

Ans.

Server-Side Rendering (SSR) is the process of rendering web pages on the server and sending the HTML to the client.

  • SSR improves website performance and SEO by reducing load times and providing search engines with fully rendered pages.

  • React provides a library called ReactDOMServer that allows developers to render React components on the server.

  • SSR requires a server-side framework or library, such as Next.js or Gatsby, to handle the rendering and routing of pages.

  • SSR can be com...read more

Q52. What is dom ? How we can change Html tag using javascript and dom

Ans.

DOM stands for Document Object Model. It is a programming interface for web documents. We can change HTML tags using JavaScript by manipulating the DOM.

  • DOM is a tree-like structure that represents the HTML document as a hierarchy of objects.

  • We can access and modify HTML elements using methods like getElementById, getElementsByClassName, etc.

  • To change HTML tags, we can use properties like innerHTML, innerText, or create new elements using createElement and appendChild.

Q53. How Netflix video loading works it was of system design

Ans.

Netflix uses a content delivery network (CDN) to efficiently load videos based on user location and network conditions.

  • Netflix uses a distributed network of servers to store and deliver video content closer to users for faster loading times.

  • Content is cached on servers located in various regions to reduce latency and improve streaming quality.

  • Netflix employs adaptive bitrate streaming to adjust video quality based on available bandwidth, ensuring smooth playback even on slowe...read more

Q54. What is Redux ? How we are using it in real time

Ans.

Redux is a predictable state container for JavaScript apps.

  • Redux is a state management library for JavaScript applications.

  • It helps in managing the state of the application in a predictable way.

  • Redux stores the entire state of the application in a single immutable object.

  • Actions are dispatched to update the state, and reducers specify how the state changes in response to actions.

  • Redux is commonly used with React to manage the state of complex applications.

  • Example: In a shoppi...read more

Are these interview questions helpful?

Q55. Q1 How to find factorial of the number

Ans.

Factorial of a number is the product of all positive integers up to that number.

  • Use a loop to multiply all positive integers up to the given number.

  • If the given number is 0 or 1, return 1.

  • Recursively call the function to find the factorial of the given number.

  • Handle negative numbers by returning undefined or throwing an error.

Q56. Find the names of students whose average marks are greater than 85

Ans.

Filter students with average marks > 85

  • Calculate average marks for each student

  • Filter students with average marks > 85

  • Return names of filtered students

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q57. Types of hooks and when and why to use custom hooks

Ans.

Hooks are functions that let you use state and other React features in functional components. Custom hooks are reusable logic functions created by developers.

  • Types of hooks: useState, useEffect, useContext, useReducer, useCallback, useMemo, useRef, useImperativeHandle, useLayoutEffect, useDebugValue

  • Custom hooks are used to extract and reuse logic from components, making code more modular and easier to maintain

  • Custom hooks can be used to share logic between components, handle ...read more

Q58. How is 'this' handled in arrow functions?

Ans.

In arrow functions, 'this' is lexically scoped and does not have its own value.

  • Arrow functions do not have their own 'this' value, they inherit 'this' from the enclosing lexical context.

  • Arrow functions are useful when you want to preserve the value of 'this' from the surrounding code.

  • Regular functions have their own 'this' value, which can change depending on how the function is called.

React Js Frontend Developer Jobs

React Js Frontend Developer - Infosys (PAN INDIA) 2-7 years
Infosys
3.6
Hyderabad / Secunderabad
React Js Frontend Developer 7-12 years
Photon
4.0
Hyderabad / Secunderabad
React Js Frontend Developer_ Pune, Bangalore 3-8 years
Infosys
3.6
Hyderabad / Secunderabad

Q59. How will you optimize your web application?

Ans.

Optimizing a web application involves improving performance, speed, and user experience.

  • Minify and compress CSS, JavaScript, and images to reduce load times

  • Implement lazy loading for images and content to improve initial load time

  • Use server-side rendering to improve SEO and initial load performance

  • Optimize database queries and use caching to reduce server load

  • Implement code splitting to only load necessary code for each page

  • Use a content delivery network (CDN) to cache static...read more

Q60. What is react and how it works how it is all about, hooks and redux

Ans.

React is a JavaScript library for building user interfaces.

  • React allows developers to create reusable UI components.

  • It uses a virtual DOM to efficiently update the UI.

  • React Hooks provide a way to use state and other React features in functional components.

  • Redux is a state management library that can be used with React to manage application state.

Q61. what will be the output async function run(data){ await console.log(data); } console.log(1); run(2); console.log(3);

Ans.

The output will be 1, 2, 3 in order.

  • The console.log(1) statement will be executed first, printing 1 to the console.

  • The run(2) function will be called asynchronously, but since it is using await, it will wait for the console.log(2) statement to finish before moving on.

  • The console.log(3) statement will be executed last, printing 3 to the console.

Q62. What are semantic tags? << HTML based question

Ans.

Semantic tags in HTML are specific tags that provide meaning to the content they enclose.

  • Semantic tags help search engines and screen readers understand the structure of a webpage.

  • Examples of semantic tags include <header>, <footer>, <nav>, <article>, <section>, <aside>, <main>, <figure>, <figcaption>.

  • Using semantic tags improves SEO and accessibility of a website.

Q63. What is the difference between Map and Filter?

Ans.

Map is used to transform each element of an array, while Filter is used to select elements based on a condition.

  • Map returns a new array with the same length as the original array, but with each element transformed based on a provided function.

  • Filter returns a new array with only the elements that pass a provided condition function.

  • Example for Map: [1, 2, 3].map(num => num * 2) will result in [2, 4, 6].

  • Example for Filter: [1, 2, 3, 4, 5].filter(num => num % 2 === 0) will resul...read more

Q64. What is the difference between Map and ForEach?

Ans.

Map creates a new array with the results of calling a provided function on every element, while forEach executes a provided function once for each array element.

  • Map returns a new array with the same length as the original array, while forEach does not return anything.

  • Map does not mutate the original array, while forEach can mutate the original array.

  • Map is more suitable for transforming data and creating a new array, while forEach is used for executing a function on each elem...read more

Q65. How do you implement dark mode in an application?

Ans.

Implementing dark mode in an application involves changing the color scheme to darker tones for better visibility in low light environments.

  • Use CSS variables to define color schemes for light and dark modes

  • Toggle between light and dark mode using a state variable in React

  • Apply the appropriate color scheme based on the selected mode

  • Allow users to switch between light and dark mode using a toggle button

Q66. pollyfill for group method of Array

Ans.

The polyfill for group method of Array is not available in ES6, but can be implemented using reduce method.

  • The group method is used to group the elements of an array based on a given key.

  • The reduce method can be used to implement the group method by iterating over the array and creating a new object with keys as the group values and values as the array of elements belonging to that group.

  • The polyfill can be written as a function and added to the Array prototype to make it ava...read more

Q67. Can you describe some Design Patterns ?

Ans.

Design patterns are reusable solutions to common problems in software design.

  • Creational Patterns: Singleton, Factory, Builder

  • Structural Patterns: Adapter, Decorator, Facade

  • Behavioral Patterns: Observer, Strategy, Command

Q68. Describe the benefits of using SSR (server side rendering)

Ans.

SSR improves SEO, performance, and initial load time of web applications.

  • Improves SEO by serving fully rendered HTML to search engine crawlers

  • Enhances performance by reducing time to first paint and time to interactive

  • Faster initial load time for users, especially on slower network connections

  • Better support for social media crawlers and web scrapers

  • Enables content to be visible to users even if JavaScript is disabled

Q69. What is a closure in Javascript?

Ans.

A closure is a function that has access to its own scope, as well as the outer scope in which it was defined.

  • A closure allows a function to access variables from an outer function even after the outer function has finished executing.

  • Closures are commonly used to create private variables and functions in JavaScript.

  • Example: function outerFunction() { let outerVar = 'I am outer'; return function innerFunction() { console.log(outerVar); }; }

Q70. How to do neuro surgery in react component?

Ans.

Neuro surgery cannot be performed in a React component as it is a medical procedure, not a programming task.

  • Neuro surgery is a complex medical procedure that involves operating on the brain or nervous system, it cannot be done within a React component.

  • React components are used for building user interfaces in web applications, they are not designed for medical procedures.

  • It is important to understand the limitations of programming tools and not attempt to perform tasks outside...read more

Q71. What is reaches and what are its key features.

Ans.

React is a JavaScript library for building user interfaces.

  • React allows developers to create reusable UI components.

  • It uses a virtual DOM for efficient rendering.

  • React supports server-side rendering for improved performance.

  • React can be used with other libraries and frameworks like Redux.

Q72. Given a counter code in class component, convert it to functional component

Ans.

Convert a counter code from class component to functional component

  • Use useState hook to manage state in functional component

  • Remove 'this' keyword and constructor from the code

  • Update event handlers to use arrow functions or useCallback hook

Q73. Map two array of objects and display the results in lists using react

Ans.

Map two arrays of objects and display results in lists using React

  • Use the map function to iterate over each array of objects

  • Render the results in separate lists using JSX

  • Example: array1.map(item =>

  • {item.name}
  • )

Q74. Write a code in react to post some data to a public url

Ans.

Code snippet to post data to a public URL in React

  • Use the fetch API to make a POST request to the public URL

  • Convert the data to JSON before sending it in the request body

  • Handle the response from the server accordingly

Q75. Reactjs how to pass data from parent to child component?

Ans.

Data can be passed from parent to child component in React using props.

  • Parent component can pass data to child component by including it as a prop in the child component's JSX tag.

  • The child component can access the passed data using the props object.

  • Data can be passed as a string, number, boolean, object, or even a function.

  • Example:

Q76. What is redux and how to use redux in react.js?

Ans.

Redux is a state management library for JavaScript applications, commonly used with React.js.

  • Redux helps manage the state of an application in a predictable way.

  • It stores the entire state of the application in a single immutable object.

  • Actions are dispatched to update the state, and reducers specify how the state changes in response to actions.

  • Redux can be used in React.js applications by connecting components to the Redux store using the 'connect' function from 'react-redux'...read more

Q77. Differenece between null and undefined in javascript?

Ans.

Null represents an intentional absence of any value, while undefined represents a variable that has been declared but not assigned a value.

  • Null is explicitly assigned to a variable to indicate that it has no value.

  • Undefined is the default value for variables that have been declared but not initialized.

  • Null is a primitive value, while undefined is a type.

  • Null is used to represent an empty value, while undefined is used to represent an uninitialized value.

  • Example: let x = null;...read more

Q78. What is difference between display block and inline

Ans.

display block takes up full width and starts on a new line, while display inline only takes up as much width as necessary and does not start on a new line.

  • display block elements start on a new line and take up the full width available, while display inline elements do not start on a new line and only take up as much width as necessary

  • display block elements can have margin and padding applied on all four sides, while display inline elements only respect left and right margin a...read more

Q79. What is Virtual Dom ? and its work in reactjs

Ans.

Virtual DOM is a lightweight copy of the actual DOM in memory, used by React to improve performance by minimizing actual DOM manipulations.

  • Virtual DOM is a concept where a lightweight copy of the actual DOM is kept in memory.

  • React uses Virtual DOM to improve performance by minimizing actual DOM manipulations.

  • When state changes in a React component, a new Virtual DOM representation is created and compared with the previous one to determine the minimal changes needed to update ...read more

Q80. Write a function to get prime number list from 10 to 30 ?

Ans.

Function to generate prime numbers between 10 and 30.

  • Create a function that takes a range as input

  • Iterate through the range and check if each number is prime

  • Use a helper function to determine if a number is prime

  • Return an array of prime numbers within the range

Q81. What is React Query, how is it different from Redux

Ans.

React Query is a library for managing server state in React applications, while Redux is a state management library for managing client-side state.

  • React Query is specifically designed for managing server state, making it easier to fetch, cache, and update data from APIs.

  • Redux is a more general-purpose state management library that can be used for managing client-side state in a predictable way.

  • React Query provides built-in caching, pagination, and refetching capabilities, whi...read more

Q82. What is the difference between debounce and throttling

Ans.

Debounce delays the execution of a function until after a specified time period, while throttling limits the rate at which a function can be executed.

  • Debounce waits for a specified time period of inactivity before executing the function, while throttling limits the rate at which the function can be called.

  • Debounce is useful for scenarios like search bars where you want to wait for the user to finish typing before making an API call, while throttling is useful for scenarios li...read more

Q83. Concept of js and what do you mean by react js

Ans.

JS is a scripting language used for web development. React JS is a JavaScript library used for building user interfaces.

  • JS is a client-side scripting language used for web development.

  • React JS is a JavaScript library used for building user interfaces.

  • React JS allows for the creation of reusable UI components.

  • React JS uses a virtual DOM to optimize performance.

  • React JS is maintained by Facebook and has a large community of developers.

Q84. Difference between class component and functional component

Ans.

Class components are ES6 classes that extend React.Component while functional components are just plain JavaScript functions.

  • Class components have state and lifecycle methods while functional components don't.

  • Functional components are simpler and easier to read and test.

  • Class components are used when we need to manage state or use lifecycle methods.

  • Functional components are used for simple UI components that don't need state or lifecycle methods.

  • Functional components can be u...read more

Q85. Why to use uncontrolled components instead of controlled

Ans.

Uncontrolled components are useful for simple forms where you don't need to track every change in real-time.

  • Uncontrolled components are easier to set up and require less code compared to controlled components.

  • They are useful for forms with a large number of inputs where tracking every change is not necessary.

  • Uncontrolled components can be faster for rendering large forms as they do not need to re-render on every change.

Q86. how to update state in react components?

Ans.

To update state in React components, use setState() method.

  • Use setState() method to update state

  • Pass an object with updated state values to setState()

  • setState() is asynchronous, so use callback function to perform actions after state update

  • Avoid directly modifying state using this.state

  • Example: this.setState({ count: this.state.count + 1 }, () => console.log('State updated'))

Q87. what is an event loop, and its significance

Ans.

Event loop is a mechanism in JavaScript that allows for asynchronous operations to be executed in a non-blocking way.

  • Event loop is responsible for handling asynchronous operations in JavaScript.

  • It allows for non-blocking execution of code, ensuring that the program remains responsive.

  • Event loop continuously checks the call stack and the task queue, moving tasks from the queue to the stack when the stack is empty.

  • Example: setTimeout() function in JavaScript uses the event loop...read more

Q88. Program to find if substring is present in a given string without using predefined functions

Ans.

Iterate through the given string to check if the substring is present.

  • Iterate through the given string and check if each character matches the first character of the substring.

  • If a match is found, check the subsequent characters to see if they form the substring.

  • Return true if the entire substring is found within the given string, otherwise return false.

Q89. What is the symbol of javascript

Ans.

The symbol of JavaScript is the curly braces {}

  • Curly braces {} are used to define blocks of code in JavaScript

  • They are used in functions, loops, conditionals, objects, and more

  • Example: function myFunction() { console.log('Hello World!'); }

Q90. What are the hooks we can use for state management

Ans.

React hooks for state management

  • useState

  • useReducer

  • useContext

  • useMemo

  • useCallback

Q91. difference between axios and fetch? 2) can we use variable instead of usestate

Ans.

Axios is a third-party library for making HTTP requests, while Fetch is a built-in browser API.

  • Axios provides more features and flexibility compared to Fetch.

  • Axios has built-in support for handling request cancellation and automatic request retries.

  • Fetch is a newer API and has a simpler syntax compared to Axios.

  • Fetch returns a Promise that resolves to the Response object, while Axios returns a Promise that resolves to the data directly.

  • Axios has better browser compatibility c...read more

Q92. Have you worked on any B2B SaaS tools?

Ans.

Yes, I have experience working on B2B SaaS tools.

  • Developed a B2B SaaS tool for managing customer relationships

  • Integrated third-party APIs for data analytics in a B2B SaaS platform

  • Implemented user authentication and access control in a B2B SaaS application

Q93. what is more secure to use get/post

Ans.

POST is more secure than GET.

  • GET requests can be cached and logged in browser history

  • POST requests are not cached and not visible in browser history

  • Sensitive data should always be sent through POST requests

Q94. Explain Virtual DOM, Key Features of React, Hooks in React, create a todo app in react

Ans.

Virtual DOM is a lightweight copy of the actual DOM, React key features include component-based architecture, declarative syntax, and virtual DOM, React Hooks are functions that let you use state and other React features without writing a class.

  • Virtual DOM is a lightweight copy of the actual DOM that React uses to improve performance by updating only the necessary parts of the DOM.

  • Key features of React include component-based architecture, declarative syntax, and virtual DOM ...read more

Q95. 1&gt;0&gt;1 What is the output of this code in Javascript?

Ans.

The output of the code is 1.

  • The expression 1>0 evaluates to true, which is then compared to 1 resulting in true.

  • In JavaScript, true is equivalent to 1 when used in numerical operations.

Q96. How to Improve Performance of a Web application

Ans.

Improving web application performance involves optimizing code, reducing network requests, and utilizing caching techniques.

  • Optimize code by removing unnecessary code, using efficient algorithms, and minimizing DOM manipulation.

  • Reduce network requests by combining files, using asynchronous loading, and implementing lazy loading.

  • Utilize caching techniques such as browser caching, server-side caching, and CDN caching to reduce load times.

Q97. Explain lifecycle of function component using useEffect

Ans.

useEffect is a hook in React that allows for side effects in function components.

  • useEffect is used to perform side effects in function components.

  • It runs after every render by default.

  • It can be used to fetch data, subscribe to events, or update the DOM.

  • To mimic componentDidMount, pass an empty array as the second argument.

  • To mimic componentDidUpdate, pass a variable or state that useEffect depends on.

Q98. How Asynchronous behaviour can be achieved in Js

Ans.

Asynchronous behavior in JavaScript can be achieved using callbacks, promises, and async/await.

  • Callbacks: Functions passed as arguments to be executed once an asynchronous operation is completed.

  • Promises: Objects representing the eventual completion or failure of an asynchronous operation.

  • Async/Await: Syntactic sugar built on top of promises to write asynchronous code that looks synchronous.

Q99. What is difference between useState, useContext and redux

Ans.

useState is for managing state within a component, useContext is for sharing state between components, and redux is for managing global state across the application.

  • useState is a React hook used to manage state within a functional component

  • useContext is a React hook used to share state between components without prop drilling

  • Redux is a state management library that allows for managing global state across the application

  • useState is local to a component, useContext can be used ...read more

Q100. what inline level and block level elements

Ans.

Inline and block level elements are two types of HTML elements with different display behaviors.

  • Inline elements flow in the same line as surrounding content, while block level elements take up the full width available.

  • Examples of inline elements include <span>, <a>, and <strong>.

  • Examples of block level elements include <div>, <p>, and <h1>.

Previous
1
2
3
4
5
6
7
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.5k Interviews
3.8
 • 8.2k Interviews
3.6
 • 7.6k Interviews
3.7
 • 5.6k Interviews
3.7
 • 4.8k Interviews
3.8
 • 2.9k Interviews
3.4
 • 1.1k Interviews
3.7
 • 538 Interviews
3.5
 • 332 Interviews
3.6
 • 262 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Recently Viewed
INTERVIEWS
Exicom
No Interviews
JOBS
Neev Group of Companies
No Jobs
INTERVIEWS
Exicom
No Interviews
INTERVIEWS
Sound Castings
No Interviews
INTERVIEWS
Ixigo.com
No Interviews
INTERVIEWS
JCB
No Interviews
INTERVIEWS
Sony
No Interviews
SALARIES
Luminous Power Technologies
INTERVIEWS
JCB
No Interviews
INTERVIEWS
JCB
No Interviews
React Js Frontend Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter