React Js Frontend Developer

60+ React Js Frontend Developer Interview Questions and Answers for Freshers

Updated 28 Feb 2025
search-icon

Q1. 1. What is difference between abstract class and interface ?

Ans.

Abstract class can have implementation while interface cannot. A class can implement multiple interfaces but only extend one abstract class.

  • Abstract class can have constructors while interface cannot.

  • Abstract class can have non-abstract methods while interface can only have abstract methods.

  • A class can implement multiple interfaces but only extend one abstract class.

  • Abstract class can have instance variables while interface cannot.

  • Abstract class is used for code reusability w...read more

Q2. 3. What is Difference between primary key and unique key ?

Ans.

Primary key uniquely identifies a record in a table, while unique key ensures that all values in a column are distinct.

  • Primary key is used to enforce entity integrity, while unique key enforces domain integrity.

  • A table can have only one primary key, but multiple unique keys.

  • Primary key can't have null values, while unique key can have null values.

  • Primary key is automatically indexed, while unique key may or may not be indexed.

Q3. 2. What is Arrow Function in Javascripts?

Ans.

Arrow functions are a concise way to write functions in JavaScript.

  • Arrow functions have a shorter syntax compared to regular functions.

  • They do not have their own 'this' value, instead, they inherit 'this' from the surrounding context.

  • Arrow functions are always anonymous and cannot be used as constructors.

  • They are commonly used in React components for event handlers and callback functions.

Q4. 5. Why we require interface and what is interface in java ?

Ans.

Interfaces in Java provide a way to achieve abstraction and multiple inheritance.

  • Interfaces define a set of methods that a class must implement.

  • They allow for loose coupling between classes.

  • Interfaces can be used to achieve polymorphism.

  • Java does not support multiple inheritance, but interfaces provide a way to achieve it.

  • Interfaces are used extensively in Java frameworks like Spring and Hibernate.

Are these interview questions helpful?

Q5. 4. how you join three different tables in SQL ?

Ans.

To join three different tables in SQL, you can use the JOIN keyword along with the appropriate join conditions.

  • Use the JOIN keyword to combine tables based on a common column

  • Specify the join conditions using the ON keyword

  • You can join more than two tables by chaining multiple JOIN statements

  • Different types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN

Q6. 9. What is difference between overloading and overriding?

Ans.

Overloading is having multiple methods with the same name but different parameters. Overriding is implementing a method in a subclass that already exists in the parent class.

  • Overloading is compile-time polymorphism while overriding is runtime polymorphism.

  • Overloading is used to provide different ways of calling the same method with different parameters.

  • Overriding is used to provide a specific implementation of a method in a subclass that is already defined in the parent class...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. 7. Is exception handling is required in a big project or we don't have to handle exception?

Ans.

Yes, exception handling is required in a big project.

  • Exception handling helps in identifying and resolving errors during runtime.

  • It improves the stability and reliability of the application.

  • Exceptions can occur due to various reasons like network issues, server errors, or user input errors.

  • Handling exceptions gracefully prevents the application from crashing and provides a better user experience.

  • It allows for proper error logging and debugging, making it easier to identify an...read more

Q8. 10. Which are the access specifiers in java ?

Ans.

Access specifiers in Java are keywords that determine the visibility of a class, method, or variable.

  • There are four access specifiers in Java: public, private, protected, and default.

  • Public: accessible from anywhere in the program.

  • Private: accessible only within the same class.

  • Protected: accessible within the same class, subclasses, and same package.

  • Default: accessible within the same package only.

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.1
Hyderabad / Secunderabad
React Js Frontend Developer_ Pune, Bangalore 3-8 years
Infosys
3.6
Hyderabad / Secunderabad

Q9. 6. What is Encapsulation in java with example ?

Ans.

Encapsulation is a mechanism of wrapping data and code acting on the data together as a single unit.

  • Encapsulation is used to hide the implementation details of an object from the outside world.

  • It helps in achieving data abstraction and data hiding.

  • In Java, encapsulation is achieved by declaring the variables of a class as private and providing public getter and setter methods to access and modify the data.

  • Example: A bank account class with private variables like account numbe...read more

Q10. How to find index of the 3rd element of an array like let arr=["one", "two", "three", "four", "five"] Now find the index of 5th element of an array without using index of method

Ans.

Finding index of elements in an array in JavaScript

  • To find the index of the 3rd element, use arr.indexOf('three')

  • To find the index of the 5th element without using indexOf, use arr[4]

  • Arrays in JavaScript are zero-indexed, so the 5th element is at index 4

Q11. Create a Admin(child component) component and add to it form and and the data submitted by the form should be shown on parent component (app.js)

Ans.

Create an Admin component with a form that submits data to the parent component.

  • Create a child component called Admin

  • Add a form to the Admin component

  • Handle form submission in the Admin component

  • Pass the submitted data to the parent component using props

  • Render the submitted data in the parent component

Q12. what is closuer? is normal function call as closuer or not

Ans.

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 its outer function even after the outer function has finished executing.

  • Closures are created whenever a function is defined within another function.

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

Q13. What is lazy loading and how we can implement in our project.

Ans.

Lazy loading is a technique used to defer loading non-essential resources until they are needed.

  • Lazy loading helps improve performance by only loading resources when they are required.

  • In React, lazy loading can be implemented using React.lazy() and Suspense components.

  • Example: const MyComponent = React.lazy(() => import('./MyComponent'));

  • Example: Loading...}>

Q14. What is react routing and how it is different from other conventional routing methods.

Ans.

React routing is a way to handle navigation in a React application by defining routes and rendering components based on the URL.

  • React routing allows for declarative routing, where routes are defined using JSX elements.

  • It enables dynamic routing based on the URL, allowing for different components to be rendered based on the route.

  • React Router is a popular library for handling routing in React applications.

  • Unlike conventional routing methods, React routing is more efficient as ...read more

Q15. For loop, event listener in react,what is usesState , what is use effect ,hooks in react

Ans.

useState and useEffect are hooks in React used for managing state and side effects respectively.

  • useState is a hook used to add state to functional components in React

  • useEffect is a hook used to perform side effects in functional components

  • Hooks in React allow functional components to have state and lifecycle methods similar to class components

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

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

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

Q19. what is difference b/w redux and redux toolkit

Ans.

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

Q20. What are access modifiers in programming?

Ans.

Access modifiers are keywords in programming that define the accessibility of classes, methods, and variables.

  • Access modifiers control the visibility and accessibility of classes, methods, and variables within a program.

  • Common access modifiers include public, private, protected, and default (package-private).

  • Public access modifier allows the class, method, or variable to be accessed from any other class.

  • Private access modifier restricts access to only within the same class.

  • Pr...read more

Q21. Tell me difference between Let, Var, Cost and

Ans.

Let, var, and const are used to declare variables in JavaScript, with differences in scope and mutability.

  • let: block-scoped, can be reassigned

  • var: function-scoped, can be reassigned

  • const: block-scoped, cannot be reassigned

Q22. What programming languages do you know?

Ans.

I am proficient in JavaScript, HTML, CSS, and ReactJs.

  • JavaScript

  • HTML

  • CSS

  • ReactJs

Q23. how to manage state using redux

Ans.

Redux is a predictable state container for JavaScript apps. It helps manage the state of an application in a centralized store.

  • Create a Redux store to hold the state of the application

  • Define actions to describe state changes

  • Write reducers to specify how the state changes in response to actions

  • Dispatch actions to update the state in the store

  • Connect components to the Redux store using the connect function from react-redux

Q24. make a collection of objects from the given data

Ans.

Create a collection of objects from given data

  • Iterate through the data and create an object for each item

  • Assign the relevant properties to each object

  • Push each object to an array to create the collection

Q25. what is react hooks explain some

Ans.

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

  • React Hooks were introduced in React 16.8.

  • They allow you to use state and other React features in functional components.

  • Some commonly used hooks are useState, useEffect, useContext, and useRef.

  • Hooks make it easier to reuse logic across components.

  • Hooks can be used to manage component state, perform side effects, and more.

Q26. What programming languages you know

Ans.

I am proficient in JavaScript and have experience with HTML, CSS, and SQL.

  • Proficient in JavaScript

  • Experience with HTML, CSS, and SQL

  • Familiarity with React and Redux

  • Knowledge of Node.js and Express

  • Experience with Git and Agile methodologies

Q27. How we implement SSR in React.

Ans.

SSR in React is implemented using server-side rendering to pre-render React components on the server before sending them to the client.

  • Use libraries like Next.js or Gatsby to implement SSR in React.

  • Configure server to render React components on the server side.

  • Optimize server-side rendering for performance by caching rendered components.

Q28. Call, bind and apply and its application

Ans.

Call, bind, and apply are methods used to manipulate the context of a function in JavaScript.

  • Call - allows you to call a function with a specified 'this' value and arguments provided individually.

  • Example: function greet(name) { return 'Hello ' + name; } greet.call(null, 'John');

  • Bind - creates a new function that, when called, has its 'this' keyword set to the provided value.

  • Example: const greetJohn = greet.bind(null, 'John'); greetJohn();

  • Apply - similar to call, but arguments...read more

Q29. what is react hooks and props

Ans.

React hooks are functions that allow you to use state and other React features in functional components. Props are used to pass data between components.

  • React hooks are introduced in React 16.8 as a way to write reusable logic in functional components.

  • Hooks like useState and useEffect are used to manage state and perform side effects in functional components.

  • Props are used to pass data from a parent component to a child component.

  • Props are read-only and cannot be modified by t...read more

Q30. What is global state management?

Ans.

Global state management is a way to manage and share state data across multiple components in a React application.

  • It helps in avoiding prop drilling by providing a centralized location for storing and updating state.

  • Common libraries for global state management in React include Redux, Context API, and MobX.

  • Global state management allows for easier state synchronization between components and can improve performance.

  • Example: Redux allows you to create a global store to hold app...read more

Q31. what is call bind apply?

Ans.

Call, bind, and apply are methods used to manipulate the value of 'this' in JavaScript functions.

  • Call - invokes a function with a specified 'this' value and arguments provided individually.

  • Bind - creates a new function that, when called, has its 'this' keyword set to the provided value.

  • Apply - invokes a function with a specified 'this' value and arguments provided as an array.

Q32. what is redux? Explain in code

Ans.

Redux is a predictable state container for JavaScript apps.

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

  • It allows for a single source of truth for the state

  • Actions are dispatched to update the state through reducers

  • Example: createStore, combineReducers, applyMiddleware

Q33. write a RTL test to check the button

Ans.

Writing a RTL test to check a button in React

  • Use the render and fireEvent functions from @testing-library/react

  • Find the button element using getByRole('button')

  • Simulate a click event using fireEvent.click

  • Assert that the button is visible and clickable

Q34. Difference between useMemo and useCallback

Ans.

useMemo is used for memoizing values, while useCallback is used for memoizing functions.

  • useMemo is used to memoize a value and only recompute it when its dependencies change.

  • useCallback is used to memoize a function instance and only re-create it when its dependencies change.

  • Example: useMemo can be used to memoize the result of a complex computation, while useCallback can be used to memoize a callback function passed to a child component.

Q35. What are hooks in react

Ans.

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

  • Hooks were introduced in React 16.8.

  • They allow you to use state and other React features in functional components.

  • Some commonly used hooks are useState, useEffect, useContext, and useReducer.

Q36. What are semantic tags

Ans.

Semantic tags are HTML tags that clearly define the content they contain for better accessibility and SEO.

  • Semantic tags provide meaning to the content they enclose, making it easier for search engines to understand the structure of the page.

  • Examples of semantic tags include

    ,
    ,
  • Using semantic tags improves the accessibility of the website for users with disabilities, as screen readers can interpret the content more accurately.

Q37. What is promise chaining

Ans.

Promise chaining is a technique in JavaScript where multiple asynchronous operations are chained together to execute sequentially.

  • Allows for handling multiple asynchronous operations in a more readable and organized way

  • Each promise in the chain returns a new promise, allowing for further chaining

  • Helps avoid callback hell by nesting promises inside each other

  • Example: promise1.then(result => { return promise2; }).then(result => { return promise3; })

Q38. What is redux in react

Ans.

Redux is a predictable state container for JavaScript apps.

  • Redux is a state management tool commonly used with React to manage the application's state in a predictable way.

  • It helps in maintaining a single source of truth for the state of the entire application.

  • Redux follows a unidirectional data flow, making it easier to understand how data changes over time.

  • Actions are dispatched to update the state in Redux, and reducers specify how the state should change in response to th...read more

Q39. how do you create fomes

Ans.

Forms can be created using HTML and CSS. JavaScript can be used to add interactivity and validation.

  • Use HTML to create form elements such as input, select, and textarea

  • Use CSS to style the form and its elements

  • Use JavaScript to add interactivity and validation to the form

  • Submit the form data to a server-side script for processing

  • Consider using a front-end framework like React or Angular for more complex forms

Q40. what is use effect variants?

Ans.

useEffect variants are different ways to use the useEffect hook in React for handling side effects.

  • useEffect with empty dependency array for running only once on mount

  • useEffect with dependency array for running on specific dependencies change

  • useEffect with cleanup function for cleaning up side effects

  • useEffect with return function for cleanup on unmount

Q41. sort a string and array

Ans.

Sorting a string and array

  • Use the sort() method to sort an array

  • Use the split() method to convert a string to an array

  • Use the join() method to convert an array to a string

Q42. What is state and props

Ans.

State is internal data managed by a component, while props are external data passed to a component.

  • State is mutable and can be changed within a component

  • Props are immutable and are passed down from parent components

  • State is used for managing component-specific data, while props are used for passing data between components

  • Example: State can be used to store form input values within a component, while props can be used to pass those values to a parent component

Q43. hoe does react Dom update?

Ans.

React DOM updates by comparing the virtual DOM with the actual DOM and only updating the necessary components.

  • React creates a virtual DOM to represent the UI components.

  • When a state or prop changes, React re-renders the virtual DOM.

  • React then compares the virtual DOM with the actual DOM to identify the differences.

  • Only the necessary components are updated in the actual DOM, minimizing performance impact.

Q44. what is asyn/await

Ans.

Async/await is a feature in JavaScript that allows for asynchronous code to be written in a synchronous manner.

  • Async/await is built on top of promises and provides a more readable and concise way to work with asynchronous code.

  • The 'async' keyword is used to define a function as asynchronous, allowing it to use the 'await' keyword inside it.

  • When 'await' is used, it pauses the execution of the function until the promise is resolved, and then returns the result.

  • Async/await helps...read more

Q45. React hooks and its usage

Ans.

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

  • Hooks are introduced in React 16.8 to allow state and lifecycle features in functional components.

  • useState() hook is used to add state to functional components.

  • useEffect() hook is used to perform side effects in functional components.

  • Custom hooks can be created to reuse stateful logic across components.

  • Hooks should always be used at the top level of the functional component.

Q46. Redux, middleware and its use

Ans.

Redux is a state management library for React applications. Middleware is a function that intercepts actions before they reach the reducer.

  • Redux is used to manage the state of a React application in a predictable way

  • Middleware in Redux allows you to write logic that can intercept and modify actions before they reach the reducer

  • Common middleware in Redux includes redux-thunk for async actions and redux-logger for logging actions

Q47. Virtual Dom and its use

Ans.

Virtual DOM is a lightweight copy of the actual DOM, used for efficient updates and rendering in React applications.

  • Virtual DOM is a concept in React where a lightweight copy of the actual DOM is created.

  • It allows React to efficiently update and render components by comparing the virtual DOM with the actual DOM and only making necessary changes.

  • Virtual DOM helps in improving performance by reducing the number of direct manipulations to the actual DOM.

  • Example: When a component...read more

Q48. What is closure

Ans.

Closure is the combination of a function bundled together with references to its surrounding state.

  • Closure allows a function to access variables from its outer scope even after the outer function has finished executing.

  • It is created whenever a function is defined within another function, and the inner function has access to the outer function's variables.

  • Closure helps in maintaining the state of a function and allows for data encapsulation.

Q49. What is hoisting

Ans.

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

  • Variable declarations are hoisted but not their initializations.

  • Function declarations are fully hoisted, meaning they can be called before they are declared.

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

Frequently asked in,

Q50. What is virtual DOM

Ans.

Virtual DOM is a lightweight copy of the actual DOM that React uses to improve performance by minimizing direct manipulation of the actual DOM.

  • Virtual DOM is a concept in React where a lightweight copy of the actual DOM is created and updated in memory.

  • When changes are made to the virtual DOM, React compares it with the actual DOM and only updates the necessary parts, reducing the number of direct manipulations to the actual DOM.

  • This process helps improve performance by minim...read more

Frequently asked in, ,
1
2
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.4k Interviews
3.8
 • 8.1k Interviews
3.6
 • 7.5k Interviews
3.8
 • 5.6k Interviews
3.7
 • 4.7k Interviews
3.8
 • 2.9k Interviews
3.4
 • 1.1k Interviews
3.7
 • 533 Interviews
3.6
 • 329 Interviews
3.9
 • 261 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

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