Reactjs Developer
400+ Reactjs Developer Interview Questions and Answers

Asked in Studio Graphene

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.
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

Q. What are Call, apply and bind methods, what is currying in JavaScript, closure , promises, hoisting, event Loop, restructuring.
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

Asked in Newgen Software Technologies

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.
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

Q. What is the difference between a development dependency and a regular dependency in software development?
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

Asked in NeoSOFT

Q. Develop a Progress Bar React Component from scratch, without using any third-party libraries or HTML progress bar elements.
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.

Asked in Photon Interactive

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 moreQuestions 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




Asked in Accenture

Q. How do you make a page responsive. Bootstrap layouts and alerts
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

Q. Write code for a functional component to call an API and display a list from the response.
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 🌟

Asked in Infosys

Q. What are higher-order functions in JS?
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

Q. What is the difference between a presentation component and a functional component in React.js?
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

Q. How to modularize code in ReactJs, How to perform test, what is typescript and how it's different.
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

Asked in ThumbStack Technologies

Q. What are react hooks? Explain any 5 or explain hooks which you used in your assignment
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

Asked in OneBanc Technologies

Q. What factors influence the number of cars in your state, and what is the approximate number of cars?
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

Q. What do the symbols ^ and ~ represent in the package.json file?
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.

Asked in rtCamp Solutions

Q. What is a single-page application?
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

Q. Write a general reusable form component in Reactjs where fields are dynamic and inputs to the form are displayed in a table format.
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' }]

Asked in Codewave Technologies

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.
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.
Asked in NewFangled Vision

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?
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.

Asked in Capgemini Engineering

Q. What is hoisting in JS?
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

Q. how would you validate the form using HTML? How do you validate the phone number with the country code?
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

Q. How is data passed from children to parents in React components?
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

Asked in OneBanc Technologies

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 moreFour 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.

Asked in Codewave Technologies

Q. Given an array of numbers, find how many pairs satisfy a sum equal to a given number.
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.

Asked in Phoenix Business Consulting

Q. Write code in React.js that adds circles from left to right or right to left when a button is clicked.
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

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<5){ let b = " a lessthen 5"; }else{ let b = "b is grater then 5"; } console.log(b);
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

Asked in Codewave Technologies

Q. Create a menu similar to a browser's context menu that opens panels to the right if children are present.
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

Q. What are the differences between var, let, and const in JavaScript?
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

Q. What is the difference between CSS and SASS? what is the use of Sass
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

Q. What is the component lifecycle in functional components?
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

Asked in Publicis Sapient

Q. 1. Fetch data from api and display in UI list format
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} )}
Interview Experiences of Popular Companies





Top Interview Questions for Reactjs Developer Related Skills



Reviews
Interviews
Salaries
Users

