React Js Frontend Developer
300+ React Js Frontend Developer Interview Questions and Answers
Q51. What is dom ? How we can change Html tag using javascript and dom
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.
Q52. How Netflix video loading works it was of system design
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
Q53. What is Redux ? How we are using it in real time
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
Q54. Q1 How to find factorial of the number
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.
Q55. Find the names of students whose average marks are greater than 85
Filter students with average marks > 85
Calculate average marks for each student
Filter students with average marks > 85
Return names of filtered students
Q56. Types of hooks and when and why to use custom hooks
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
Share interview questions and help millions of jobseekers 🌟
Q57. How is 'this' handled in arrow functions?
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.
Q58. How will you optimize your web application?
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
React Js Frontend Developer Jobs
Q59. What is react and how it works how it is all about, hooks and redux
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.
Q60. what will be the output async function run(data){ await console.log(data); } console.log(1); run(2); console.log(3);
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.
Q61. What are semantic tags? << HTML based question
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.
Q62. What is the difference between Map and Filter?
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
Q63. What is the difference between Map and ForEach?
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
Q64. How do you implement dark mode in an application?
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
Q65. pollyfill for group method of Array
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
Q66. Can you describe some Design Patterns ?
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
Q67. Describe the benefits of using SSR (server side rendering)
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
Q68. What is a closure in Javascript?
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); }; }
Q69. How to do neuro surgery in react component?
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
Q70. What is reaches and what are its key features.
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.
Q71. Given a counter code in class component, convert it to functional component
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
Q72. Map two array of objects and display the results in lists using react
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} )
Q73. Write a code in react to post some data to a public url
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
Q74. Reactjs how to pass data from parent to child component?
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:
Q75. What is redux and how to use redux in react.js?
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
Q76. Differenece between null and undefined in javascript?
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
Q77. What is difference between display block and inline
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
Q78. What is Virtual Dom ? and its work in reactjs
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
Q79. Write a function to get prime number list from 10 to 30 ?
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
Q80. What is React Query, how is it different from Redux
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
Q81. What is the difference between debounce and throttling
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
Q82. Concept of js and what do you mean by react js
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.
Q83. Difference between class component and functional component
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
Q84. Why to use uncontrolled components instead of controlled
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.
Q85. how to update state in react components?
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'))
Q86. what is an event loop, and its significance
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
Q87. Program to find if substring is present in a given string without using predefined functions
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.
Q88. What is the symbol of javascript
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!'); }
Q89. What are the hooks we can use for state management
React hooks for state management
useState
useReducer
useContext
useMemo
useCallback
Q90. difference between axios and fetch? 2) can we use variable instead of usestate
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
Q91. Have you worked on any B2B SaaS tools?
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
Q92. what is more secure to use get/post
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
Q93. Explain Virtual DOM, Key Features of React, Hooks in React, create a todo app in react
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
Q94. 1>0>1 What is the output of this code in Javascript?
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.
Q95. How to Improve Performance of a Web application
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.
Q96. Explain lifecycle of function component using useEffect
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.
Q97. How Asynchronous behaviour can be achieved in Js
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.
Q98. What is difference between useState, useContext and redux
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
Q99. what inline level and block level elements
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>.
Q100. what is difference b/w redux and redux toolkit
Redux Toolkit is a set of tools and best practices to simplify Redux development, while Redux is a predictable state container for JavaScript apps.
Redux Toolkit provides a set of tools like createSlice, createAsyncThunk, and configureStore to simplify Redux setup and reduce boilerplate code.
Redux Toolkit includes immer library for writing immutable update logic in a more convenient way.
Redux Toolkit also includes a default setup for Redux DevTools Extension integration.
Redux ...read more
Interview Questions of Similar Designations
Top Interview Questions for React Js Frontend Developer Related Skills
Interview experiences of popular companies
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
Reviews
Interviews
Salaries
Users/Month