Reactjs Developer

400+ Reactjs Developer Interview Questions and Answers

Updated 13 Jul 2025
search-icon
2d ago

Q. Implement a counter with increment and decrement buttons. Include an input field to set the counter's initial value, and ensure increment/decrement operations are based on this input value.

Ans.

Implement a counter with increment and decrement buttons and an input field to set the value.

  • Create a state variable to hold the counter value

  • Use onClick event handlers for the buttons to increment and decrement the counter

  • Use onChange event handler for the input field to update the counter value

  • Set the initial value of the counter to 0

  • Validate the input value to ensure it is a number

Asked in Java R & D

1d ago

Q. What are Call, apply and bind methods, what is currying in JavaScript, closure , promises, hoisting, event Loop, restructuring.

Ans.

Call, apply, and bind are methods used to manipulate the context of a function. Currying is a technique to transform a function with multiple arguments into a sequence of functions with single arguments. Closure is a feature that allows a function to access variables from its outer scope. Promises are objects used for asynchronous programming. Hoisting is a behavior where variable and function declarations are moved to the top of their containing scope. Event loop is a mechan...read more

Reactjs Developer Interview Questions and Answers for Freshers

illustration image

Q. Display a list of products using the flexbox layout. Create a sort button to sort the list and update the view of the list accordingly.

Ans.

Implement a product list with flexbox layout and sorting functionality in React.

  • Use React's useState to manage the product list and sorting order.

  • Create a Product component to display individual product details.

  • Utilize CSS Flexbox for responsive layout: e.g., 'display: flex; flex-wrap: wrap;'.

  • Implement a sort function that updates the state based on selected criteria (e.g., price, name).

  • Example sort function: 'const sortedProducts = [...products].sort((a, b) => a.price - b.pr...read more

Asked in Infosys

5d ago

Q. What is the difference between a development dependency and a regular dependency in software development?

Ans.

Development dependencies are needed for development and testing, while regular dependencies are needed for the application to run.

  • Development dependencies are used during the development process, such as testing frameworks or build tools.

  • Regular dependencies are required for the application to function properly in production.

  • Development dependencies are typically listed in the devDependencies section of package.json, while regular dependencies are listed in dependencies.

  • Examp...read more

Are these interview questions helpful?

Asked in NeoSOFT

4d ago

Q. Develop a Progress Bar React Component from scratch, without using any third-party libraries or HTML progress bar elements.

Ans.

Create a custom React Progress Bar component from scratch without using third-party libraries.

  • Use functional components and hooks for state management.

  • Create a div for the progress bar container and another for the filled portion.

  • Style the components using CSS for visual representation.

  • Use props to pass the progress value (0-100) and update the filled portion accordingly.

  • Implement a simple animation for the progress fill using CSS transitions.

2d ago

Q. what is ES6 feature small coding on how let,var,const works javascript set , closure (closure with different let scenarios) difference between function and class component use of sort destructure to insert elem...

read more
Ans.

Questions related to ReactJS development including ES6 features, lifecycle, custom hooks, and deployment.

  • ES6 features include let, const, arrow functions, and destructuring

  • Function components are simpler and class components have state and lifecycle methods

  • Sort method is used to sort arrays based on a given criteria

  • Browser router is used for client-side routing in React applications

  • Custom hooks are reusable functions that can be used across multiple components

  • Webpack is a mod...read more

Reactjs Developer Jobs

Oracle Marketing logo
Laravel & ReactJS Developer 3-4 years
Oracle Marketing
3.7
₹ 4 L/yr - ₹ 4 L/yr
Kolkata
Infosys logo
React JS Developer 3-8 years
Infosys
3.6
Hyderabad / Secunderabad
Tata Consultancy Services logo
React JS Developer 7-12 years
Tata Consultancy Services
3.6
Bangalore / Bengaluru

Asked in Accenture

6d ago

Q. How do you make a page responsive. Bootstrap layouts and alerts

Ans.

To make a page responsive, use Bootstrap layouts and alerts.

  • Use Bootstrap's grid system to create responsive layouts

  • Use media queries to adjust the layout based on screen size

  • Use Bootstrap's responsive utility classes to hide/show elements on different devices

  • Use Bootstrap's responsive navigation components for mobile-friendly menus

  • Use Bootstrap's responsive images to ensure they scale properly

  • Use Bootstrap's responsive embeds for videos and other media

  • Use Bootstrap's respons...read more

Asked in Metafic

6d ago

Q. Write code for a functional component to call an API and display a list from the response.

Ans.

Code for functional component to call API and show list from response

  • Use useEffect hook to call API on component mount

  • Use useState hook to store API response

  • Map through response data to display list

  • Handle loading and error states

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Asked in Infosys

5d ago

Q. What are higher-order functions in JS?

Ans.

Higher-order functions are functions that take one or more functions as arguments or return a function as their result.

  • Higher-order functions can be used to create reusable code by abstracting common patterns.

  • They enable functional programming paradigms like currying and composition.

  • Examples of higher-order functions in JavaScript include map, filter, and reduce.

Asked in Infosys

4d ago

Q. What is the difference between a presentation component and a functional component in React.js?

Ans.

Presentation components are class components that handle rendering, while functional components are simpler and handle stateless rendering.

  • Presentation components are also known as container components.

  • Functional components are also known as stateless components.

  • Presentation components are used for complex UI logic and state management.

  • Functional components are used for simple UI logic and stateless rendering.

  • Functional components are easier to test and maintain.

  • Example of pr...read more

Asked in Java R & D

4d ago

Q. How to modularize code in ReactJs, How to perform test, what is typescript and how it's different.

Ans.

Modularizing code in ReactJs involves breaking down the application into smaller components for better organization and reusability.

  • Create separate components for different parts of the UI

  • Use props to pass data and functions between components

  • Use state to manage component-specific data

  • Use React Router to handle routing and navigation

  • Use CSS modules or styled-components for component-specific styling

  • Use Redux or Context API for state management across components

  • Perform unit te...read more

Q. What are react hooks? Explain any 5 or explain hooks which you used in your assignment

Ans.

React hooks are functions that let you use state and other React features without writing a class.

  • useState() - allows functional components to have local state

  • useEffect() - performs side effects in function components

  • useContext() - allows you to subscribe to React context without introducing nesting

  • useReducer() - an alternative to useState for more complex state logic

  • useMemo() - memoizes the result of a function

4d ago

Q. What factors influence the number of cars in your state, and what is the approximate number of cars?

Ans.

The number of cars in a state depends on factors such as population, income, and infrastructure.

  • Population density affects the number of cars on the road.

  • Higher income levels lead to more car ownership.

  • Availability of public transportation can decrease the number of cars.

  • Infrastructure, such as highways and parking, can also impact car usage.

  • The number of cars in a state can vary greatly depending on these factors.

  • In round figures, the number of cars in a state could range fr...read more

Asked in Infosys

4d ago

Q. What do the symbols ^ and ~ represent in the package.json file?

Ans.

Symbols ^ and ~ in package.json represent version ranges for dependencies.

  • The symbol ^ represents a range that allows minor version updates.

  • The symbol ~ represents a range that allows only patch updates.

  • For example, ^1.2.3 allows any version from 1.2.3 to <2.0.0, while ~1.2.3 allows any version from 1.2.3 to <1.3.0.

1d ago

Q. What is a single-page application?

Ans.

A single page application is a web application that loads once and dynamically updates the content without refreshing the page.

  • Loads once and dynamically updates content

  • No page refreshes

  • Uses JavaScript frameworks like React to handle routing and rendering

  • Improves user experience by providing a seamless and responsive interface

Asked in Accenture

6d ago

Q. Write a general reusable form component in Reactjs where fields are dynamic and inputs to the form are displayed in a table format.

Ans.

A reusable React form component that dynamically generates fields and displays inputs in a table format.

  • Use React's state to manage form data dynamically.

  • Utilize a mapping function to render form fields based on an array of field definitions.

  • Implement a submit handler to process the form data.

  • Display the form inputs in a table format using HTML table elements.

  • Example of field definitions: [{ label: 'Name', type: 'text' }, { label: 'Age', type: 'number' }]

4d ago

Q. Write a function that takes an object in the format {l : object| number , o: +|- , p: object| number} and uses recursion to flatten the object and return a string.

Ans.

A function to recursively flatten an object and return a string representation.

  • The function should handle nested objects and numbers.

  • Use recursion to traverse through the object properties.

  • Concatenate the keys and values into a single string.

  • Example input: {l: {x: 1}, o: '+', p: 2} should return 'x:1 + 2'.

  • Ensure to handle both objects and numbers appropriately.

1d ago

Q. Coding Question, Find largest element in array without sort, find sum of all element in array, find count of each element in array like how many times each element occurred in array?

Ans.

Find largest element, sum of all elements, and count of each element in array without sorting.

  • To find the largest element, iterate through the array and keep track of the maximum value.

  • To find the sum of all elements, iterate through the array and add each element to a running total.

  • To find the count of each element, use a hashmap to store the count of each element as you iterate through the array.

2d ago

Q. What is hoisting in JS?

Ans.

Hoisting is a JavaScript behavior where variable and function declarations are moved to the top of their containing scope.

  • Hoisting applies to both variable and function declarations.

  • Variable declarations are hoisted but not their initializations.

  • Function declarations are fully hoisted, allowing them to be called before they are declared.

  • Hoisting does not apply to variables declared with let or const.

  • Hoisting can lead to unexpected behavior if not understood properly.

Asked in LTIMindtree

4d ago

Q. how would you validate the form using HTML? How do you validate the phone number with the country code?

Ans.

Form validation using HTML and validating phone number with country code

  • Use HTML5 form validation attributes like 'required', 'pattern', 'minlength', etc.

  • For phone number validation, use 'pattern' attribute with regex for specific country code format

  • Example: <input type='tel' pattern='[0-9]{3}-[0-9]{3}-[0-9]{4}' required>

Asked in Genpact

4d ago

Q. How is data passed from children to parents in React components?

Ans.

Data can be passed from children to parents in React components by using callback functions.

  • Use callback functions to pass data from child components to parent components

  • Parent component passes a function as a prop to child component

  • Child component calls the function with the data as an argument to pass data to parent component

3d ago

Q. Four people need to cross a bridge at night. They have one torch. A can cross in 2 minutes, B in 1 minute, C in 9 minutes, and D in 10 minutes. Only two people can cross at a time, and they must travel at the s...

read more
Ans.

Four people with different crossing times need to cross a bridge using one torch in the least time possible.

  • A and B cross first (1 min), A returns with the torch (2 min).

  • C and D cross together (10 min), B returns with the torch (1 min).

  • A and B cross again (2 min).

  • Total time = 1 + 2 + 10 + 1 + 2 = 16 minutes.

1d ago

Q. Given an array of numbers, find how many pairs satisfy a sum equal to a given number.

Ans.

Count pairs in an array that sum up to a specified number using efficient algorithms.

  • Use a hash map to store numbers and their counts for O(n) time complexity.

  • For each number, check if the complement (target - number) exists in the map.

  • Example: For array [1, 2, 3, 4] and target 5, pairs are (1,4) and (2,3).

  • Handle duplicates carefully to avoid overcounting pairs.

Q. Write code in React.js that adds circles from left to right or right to left when a button is clicked.

Ans.

A React.js code example to add circles dynamically on button click, either from left to right or right to left.

  • Use React's useState to manage the array of circles.

  • Create a button that triggers a function to add a new circle.

  • Use CSS for styling the circles and positioning them.

  • Implement a conditional to determine the direction of addition.

Asked in LTIMindtree

5d ago

Q. tell me the output 1)a = 20; console.log(a); var a; 2)b=10; console.log(b); let b; 3)let a =5; if(a&lt;5){ let b = " a lessthen 5"; }else{ let b = "b is grater then 5"; } console.log(b);

Ans.

The output for the given code snippets will be: 1) 20 2) ReferenceError: Cannot access 'b' before initialization 3) ReferenceError: b is not defined

  • In the first snippet, variable 'a' is declared using 'var' after it is assigned a value, so it logs 20 without any issues.

  • In the second snippet, variable 'b' is declared using 'let' after it is assigned a value, so it throws a ReferenceError as 'b' is accessed before initialization.

  • In the third snippet, variable 'b' is declared us...read more

3d ago

Q. Create a menu similar to a browser's context menu that opens panels to the right if children are present.

Ans.

Create a context menu in React that opens panels on the right when children are present.

  • Use a state variable to manage the visibility of the context menu.

  • Implement a right-click event listener to trigger the context menu.

  • Render the context menu conditionally based on the presence of children.

  • Use CSS for styling the context menu and panels for a better user experience.

  • Example: <ContextMenu>{children}</ContextMenu> to render children.

Asked in Enmovil

1d ago

Q. What are the differences between var, let, and const in JavaScript?

Ans.

var is function scoped, let and const are block scoped.

  • var can be redeclared and updated within its scope

  • let can be updated but not redeclared within its scope

  • const cannot be updated or redeclared once declared

  • let and const are not hoisted like var

  • const must be initialized during declaration

Asked in LTIMindtree

4d ago

Q. What is the difference between CSS and SASS? what is the use of Sass

Ans.

SASS is a preprocessor scripting language that is interpreted into CSS, offering more features and flexibility.

  • SASS is a preprocessor for CSS, allowing for variables, nesting, and mixins to be used in stylesheets.

  • SASS code needs to be compiled into CSS before being used in a web project.

  • SASS helps in writing cleaner and more organized CSS code, making it easier to maintain and update styles.

  • CSS is the styling language used for web development, while SASS is a tool that extend...read more

Asked in Infosys

6d ago

Q. What is the component lifecycle in functional components?

Ans.

Component lifecycle in functional components involves useEffect hook for side effects.

  • Functional components use useEffect hook to handle side effects like fetching data, subscribing to events, etc.

  • useEffect hook can be used to mimic componentDidMount, componentDidUpdate, and componentWillUnmount lifecycle methods.

  • useEffect hook takes a callback function as its first argument and an optional array of dependencies as its second argument.

  • The callback function inside useEffect ru...read more

3d ago

Q. 1. Fetch data from api and display in UI list format

Ans.

Answering how to fetch data from API and display in UI list format for Reactjs Developer interview.

  • Use fetch or axios to fetch data from API

  • Store the data in state or Redux store

  • Map through the data and display in UI list format

  • Handle loading and error states

  • Example: fetch('https://api.example.com/data').then(response => response.json()).then(data => setData(data))

  • Example: {data.map(item =>

  • {item.name}
  • )}

1
2
3
4
5
6
7
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Accenture Logo
3.7
 • 8.7k Interviews
Infosys Logo
3.6
 • 7.9k Interviews
Cognizant Logo
3.7
 • 5.9k Interviews
Capgemini Logo
3.7
 • 5.1k Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Reactjs Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits