i
Infosys
Work with us
Filter interviews by
Fragments in React allow grouping multiple elements without adding extra nodes to the DOM.
Fragments are used to return multiple elements from a component without wrapping them in a div.
Example: Instead of <div><Child1 /><Child2 /></div>, use <><Child1 /><Child2 /></>.
They help in reducing unnecessary DOM elements, improving performance.
You can use <React.Fragment&...
In Jest, 'describe' groups tests, while 'it' defines individual test cases.
'describe' is used to create a test suite, grouping related tests together.
'it' is used to define a single test case within a test suite.
Example of 'describe': describe('Array methods', () => { ... });
Example of 'it': it('should return the correct length', () => { ... });
'describe' can contain multiple 'it' blocks to test various ...
Hooks are functions that let you use state and lifecycle features in functional components in React.
Hooks allow functional components to manage state without using class components. Example: useState hook.
They enable side effects in functional components. Example: useEffect hook for data fetching.
Custom hooks can be created to encapsulate reusable logic across components.
Hooks follow a specific naming convention, ...
A Promise is an object representing the eventual completion or failure of an asynchronous operation in JavaScript.
Promises can be in one of three states: pending, fulfilled, or rejected.
A fulfilled promise returns a value, while a rejected promise returns an error.
Example: const myPromise = new Promise((resolve, reject) => { /* async operation */ });
You can handle the result of a promise using .then() for succe...
To optimize data fetching in React, techniques like pagination, lazy loading, and caching can significantly reduce load times.
Pagination: Instead of fetching all 1000 records at once, implement pagination to load data in chunks, e.g., 100 records per request.
Lazy Loading: Load data only when needed, such as when a user scrolls down or navigates to a specific section of the app.
Caching: Use caching mechanisms like ...
Class components use ES6 classes, while functional components are simpler functions. Both render UI but differ in syntax and features.
Class components can hold and manage local state using 'this.state'. Example: 'this.setState({ count: this.state.count + 1 })'.
Functional components are stateless by default but can use hooks (like useState) to manage state. Example: 'const [count, setCount] = useState(0)'.
Class com...
Create a simple React form to capture name and age, and log the data to the console on submission.
Use functional components and hooks like useState for managing form state.
Create a form with controlled components for input fields.
Handle form submission with an onSubmit event handler.
Use console.log to display the captured data in the console.
Web Workers are a way to run JavaScript code in the background, separate from the main thread of the web application.
Web Workers allow for multi-threading in JavaScript, improving performance by offloading tasks to separate threads.
They can be used for tasks like heavy calculations, image processing, or other CPU-intensive operations.
Communication between the main thread and Web Workers is done through message pas...
Implementing Redux in a React application involves several steps to manage state globally.
Install Redux and React-Redux libraries using npm or yarn.
Create a Redux store to hold the state of the application.
Define reducers to specify how the state should change in response to actions.
Dispatch actions to update the state in the Redux store.
Connect React components to the Redux store using the connect function from R...
A closure is a function that has access to its own scope, as well as the 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 in JavaScript.
Example: function outerFunction() { let outerVar = 'I am outer'; return function innerFunction() { console.log(outerVar);...
ES6 introduces new features like arrow functions, classes, and modules, enhancing JavaScript's capabilities and syntax.
Arrow Functions: Shorter syntax for writing functions. Example: const add = (a, b) => a + b;
Template Literals: Multi-line strings and string interpolation. Example: const greeting = `Hello, ${name}!`;
Destructuring Assignment: Unpacking values from arrays or properties from objects. Example: const [x...
Shallow copy duplicates the top-level structure, while deep copy duplicates all nested objects recursively.
Shallow copy creates a new object but copies references to nested objects.
Example: Using Object.assign() or spread operator for shallow copy.
Deep copy creates a new object and recursively copies all nested objects.
Example: Using JSON.parse(JSON.stringify(obj)) for deep copy.
Modifying nested objects in a shallow co...
I applied via Company Website and was interviewed in Sep 2024. There were 2 interview rounds.
To call a dummy API, use fetch() method with the API URL and handle the response using .then()
Use fetch() method to make a GET request to the dummy API URL
Handle the response using .then() method to access the data returned by the API
You can also use async/await syntax for cleaner code
Virtual DOM is a lightweight copy of the original DOM that React uses to improve performance by minimizing actual DOM manipulation.
Virtual DOM is a representation of the actual DOM in memory.
React compares the virtual DOM with the original DOM and only updates the parts that have changed.
Virtual DOM updates are faster than directly manipulating the original DOM.
Virtual DOM helps in optimizing performance by reducing th...
useEffect is a React hook that allows for side effects in functional components.
useEffect is used to perform side effects in functional components.
It runs after every render by default.
It can be used to fetch data, subscribe to events, update the DOM, and more.
To run useEffect only once, pass an empty array as the second argument.
To clean up effects, return a function from useEffect.
useMemo optimizes performance by memoizing expensive calculations in React components.
useMemo is a React hook that memoizes the result of a computation.
It helps prevent unnecessary recalculations on re-renders.
Example: const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b]);
useMemo should be used selectively for expensive calculations, not for every component.
Overusing useMemo can lead to more compl...
I appeared for an interview in Mar 2025, where I was asked the following questions.
Class components use ES6 classes, while functional components are simpler functions. Both render UI but differ in syntax and features.
Class components can hold and manage local state using 'this.state'. Example: 'this.setState({ count: this.state.count + 1 })'.
Functional components are stateless by default but can use hooks (like useState) to manage state. Example: 'const [count, setCount] = useState(0)'.
Class componen...
A Promise is an object representing the eventual completion or failure of an asynchronous operation in JavaScript.
Promises can be in one of three states: pending, fulfilled, or rejected.
A fulfilled promise returns a value, while a rejected promise returns an error.
Example: const myPromise = new Promise((resolve, reject) => { /* async operation */ });
You can handle the result of a promise using .then() for success an...
Hooks are functions that let you use state and lifecycle features in functional components in React.
Hooks allow functional components to manage state without using class components. Example: useState hook.
They enable side effects in functional components. Example: useEffect hook for data fetching.
Custom hooks can be created to encapsulate reusable logic across components.
Hooks follow a specific naming convention, start...
Fragments in React allow grouping multiple elements without adding extra nodes to the DOM.
Fragments are used to return multiple elements from a component without wrapping them in a div.
Example: Instead of <div><Child1 /><Child2 /></div>, use <><Child1 /><Child2 /></>.
They help in reducing unnecessary DOM elements, improving performance.
You can use <React.Fragment> o...
Foreach, Filter, and Map are array methods in JavaScript for iterating and transforming data.
forEach: Executes a provided function once for each array element. Example: [1, 2, 3].forEach(num => console.log(num));
filter: Creates a new array with elements that pass a test. Example: [1, 2, 3, 4].filter(num => num > 2); // [3, 4]
map: Creates a new array by applying a function to each element. Example: [1, 2, 3].ma...
Jest is a JavaScript testing framework designed for simplicity, focusing on unit testing and providing a rich API for assertions.
Zero Configuration: Jest works out of the box for most JavaScript projects, requiring minimal setup to get started.
Snapshot Testing: Jest allows you to take snapshots of your components and compare them during tests to ensure UI consistency.
Mocking Functions: Jest provides built-in mocking ca...
To optimize data fetching in React, techniques like pagination, lazy loading, and caching can significantly reduce load times.
Pagination: Instead of fetching all 1000 records at once, implement pagination to load data in chunks, e.g., 100 records per request.
Lazy Loading: Load data only when needed, such as when a user scrolls down or navigates to a specific section of the app.
Caching: Use caching mechanisms like local...
Create a simple React form to capture name and age, and log the data to the console on submission.
Use functional components and hooks like useState for managing form state.
Create a form with controlled components for input fields.
Handle form submission with an onSubmit event handler.
Use console.log to display the captured data in the console.
In Jest, 'describe' groups tests, while 'it' defines individual test cases.
'describe' is used to create a test suite, grouping related tests together.
'it' is used to define a single test case within a test suite.
Example of 'describe': describe('Array methods', () => { ... });
Example of 'it': it('should return the correct length', () => { ... });
'describe' can contain multiple 'it' blocks to test various scena...
I applied via Recruitment Consulltant and was interviewed in Jun 2024. There was 1 interview round.
A closure is a function that has access to its own scope, as well as the 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 in JavaScript.
Example: function outerFunction() { let outerVar = 'I am outer'; return function innerFunction() { console.log(outerVar); }; }
Web Workers are a way to run JavaScript code in the background, separate from the main thread of the web application.
Web Workers allow for multi-threading in JavaScript, improving performance by offloading tasks to separate threads.
They can be used for tasks like heavy calculations, image processing, or other CPU-intensive operations.
Communication between the main thread and Web Workers is done through message passing.
...
A first class function is a function that can be treated like any other variable in a programming language.
Can be passed as an argument to other functions
Can be returned from other functions
Can be assigned to variables
Can be stored in data structures
First paint refers to the time when the browser starts rendering pixels to the screen. Temporal dead zone is a period in JavaScript where a variable exists but cannot be accessed.
First paint is the time when the browser starts rendering content on the screen.
Temporal dead zone is a period in JavaScript where a variable is declared but cannot be accessed due to the variable being in an inaccessible state.
Example: const ...
Callbacks, event delegation, React reconciliation, and React lifecycle methods are key concepts in React development.
Callback functions are functions passed as arguments to be executed later, commonly used in event handling and asynchronous operations.
Event delegation is a technique where a single event listener is attached to a parent element to manage events for multiple child elements.
React reconciliation is the pro...
Implementing Redux in a React application involves several steps to manage state globally.
Install Redux and React-Redux libraries using npm or yarn.
Create a Redux store to hold the state of the application.
Define reducers to specify how the state should change in response to actions.
Dispatch actions to update the state in the Redux store.
Connect React components to the Redux store using the connect function from React-...
Create a table component from array of objects in React JS
Map through the array of objects to render rows in the table
Use Object.keys() to dynamically generate table headers
Utilize CSS for styling the table
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 the execution of code in a single-threaded environment.
It continuously checks the call stack for any functions that need to be executed.
If the call stack is empty, it looks at the task queue for any pending tasks to be executed.
Event loop ensures that JavaScript rem...
I applied via LinkedIn and was interviewed in Aug 2024. There were 2 interview rounds.
Discussion about javascript concepts
Coding for react components
Props are used to pass data from parent to child components in React, while data refers to the information stored within a component.
Props are read-only and cannot be modified by the child component.
Data is mutable and can be changed within the component.
Props are passed down from parent to child components, while data is stored within the component itself.
Example: Passing a 'name' prop from a parent component to a chi...
50 minutes coding round they asked me some theoretical question and machine coding question they asked me DSA question
What people are saying about Infosys
Some of the top questions asked at the Infosys React Js Frontend Developer interview -
The duration of Infosys React Js Frontend Developer interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 25 interview experiences
Difficulty level
Duration
based on 5 reviews
Rating in categories
Technology Analyst
54.7k
salaries
| ₹4.8 L/yr - ₹10 L/yr |
Senior Systems Engineer
53.7k
salaries
| ₹2.5 L/yr - ₹6.3 L/yr |
Technical Lead
35k
salaries
| ₹7.3 L/yr - ₹20 L/yr |
System Engineer
32.5k
salaries
| ₹2.4 L/yr - ₹5.3 L/yr |
Senior Associate Consultant
31k
salaries
| ₹8.1 L/yr - ₹14 L/yr |
TCS
Wipro
Cognizant
Accenture