Reactjs Developer

20+ Reactjs Developer Interview Questions and Answers for Freshers

Updated 14 Mar 2025
search-icon

Q1. Implement counter such that it has 2 buttons to increment and decrement the values and also add a input field such that, whatever input is given, the value should be to that and value should should be decreased...

read more
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

Q2. How are data passed from children to parents in react component?

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

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

Q4. What is the difference between states and props ?

Ans.

States are mutable data managed within a component, while props are immutable data passed from parent to child components.

  • States are managed within a component and can be changed using setState method

  • Props are passed from parent to child components and are immutable

  • States are used for internal component data management, while props are used for passing data between components

  • Example: A counter component may have a state for the count value, while receiving a prop for the incr...read more

Are these interview questions helpful?

Q5. How to communicate child to parent components in react?

Ans.

Using props and callbacks to communicate data from child to parent components in React.

  • Passing data from child to parent components using props

  • Using callbacks to send data from child to parent components

  • Using context API for global state management

Q6. What are the different methods of synchronous programming in JavaScript?

Ans.

Synchronous programming in JavaScript executes code sequentially, blocking further execution until the current task completes.

  • 1. Function Calls: Functions execute in the order they are called. Example: `functionA(); functionB();`

  • 2. Loops: Iterative structures like `for` and `while` run synchronously. Example: `for (let i = 0; i < 5; i++) { console.log(i); }`

  • 3. Conditional Statements: `if` and `switch` statements execute synchronously based on conditions. Example: `if (x > 10)...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. Development cycle of a student registration app

Ans.

The development cycle of a student registration app involves planning, designing, developing, testing, and deploying the app.

  • Plan the app's features and functionality

  • Design the user interface and user experience

  • Develop the app using Reactjs and other technologies

  • Test the app for bugs and errors

  • Deploy the app to a server or hosting platform

  • Continuously maintain and update the app as needed

Q8. Explain position properties, Absolute, Fixed, Relative?

Ans.

Position properties in CSS for element placement.

  • Absolute: Element is positioned relative to its closest positioned ancestor.

  • Fixed: Element is positioned relative to the viewport.

  • Relative: Element is positioned relative to its normal position.

Reactjs Developer Jobs

React.js Developer 7-12 years
UST
3.8
Chennai
ReactJS Developer 3-5 years
Infosys Limited
3.6
Bangalore / Bengaluru
Reactjs Developer 2-4 years
Capgemini Technology Services India Limited
3.7
Bangalore / Bengaluru

Q9. What is useState and Why we use it?

Ans.

useState is a hook in React that allows functional components to have state.

  • useState is used to add state to functional components in React.

  • It returns an array with two elements - the current state value and a function to update that value.

  • Example: const [count, setCount] = useState(0);

Q10. What is Reacta and what makes it faster?

Ans.

React is a JavaScript library for building user interfaces, known for its virtual DOM and efficient rendering.

  • React uses a virtual DOM to minimize actual DOM manipulation, improving performance.

  • It employs a reconciliation algorithm to efficiently update the UI when data changes.

  • React Fiber, a reimplementation of the core algorithm, enables incremental rendering for better user experience.

  • React's component-based architecture allows for reusable and modular code, enhancing deve...read more

Q11. What is JSX and Babel?

Ans.

JSX is a syntax extension for JavaScript that allows writing HTML-like code within JavaScript. Babel is a tool used to transpile JSX code into plain JavaScript.

  • JSX stands for JavaScript XML and is used to write HTML-like code in React components

  • Babel is a JavaScript compiler that converts JSX code into plain JavaScript for browser compatibility

  • JSX allows developers to write UI components in a more declarative and readable way

  • Example:

    Hello, World!
    in JSX gets transpiled to Re...read more

Q12. What is docType in html?

Ans.

DocType in HTML specifies the version of HTML being used in the document.

  • DocType declaration is not an HTML tag.

  • It is used to inform the web browser about the version of HTML being used.

  • It is placed at the very beginning of an HTML document before the <html> tag.

  • Example: <!DOCTYPE html> for HTML5.

Q13. What is symentic elements?

Ans.

Semantic elements are HTML tags that clearly define the content they contain, making it easier for both humans and machines to understand the structure of a web page.

  • Semantic elements provide meaning to the content they enclose, improving accessibility and SEO.

  • Examples include <header>, <footer>, <nav>, <article>, <section>, <aside>, <main>, <figure>, <figcaption>.

  • Using semantic elements helps organize the content of a web page in a more structured and meaningful way.

Q14. what are different hooks?

Ans.

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

  • Hooks are 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.

  • Hooks help in reusing logic across components and making code more readable.

  • Example: useState hook is used to add state to functional components.

Q15. Reverse a string in JavaScript

Ans.

Reverse a string in JavaScript

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

  • Use the reverse() method to reverse the array

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

Q16. Number to word like 102 one hundred two

Ans.

Convert a number into words

  • Break the number into groups of three digits

  • Convert each group into words (e.g. '102' becomes 'one hundred two')

  • Combine the words with appropriate thousand/million/billion separators

Q17. What is reconciliation?

Ans.

Reconciliation is the process of updating the UI to match the current state of the application.

  • Reconciliation is the algorithm used by React to update the DOM efficiently.

  • It compares the virtual DOM with the actual DOM and only updates the parts that have changed.

  • Reconciliation is a key feature of React that helps in improving performance by minimizing DOM updates.

  • Examples of reconciliation include adding, updating, or removing elements in the UI based on changes in the appli...read more

Q18. What are states in react?

Ans.

States in React are mutable data that control the behavior of a component and determine what is rendered on the screen.

  • States are used to store and manage data within a component.

  • They are mutable and can be updated using the setState() method.

  • Changes in state trigger re-rendering of the component.

  • States are initialized in the constructor of a class component or using the useState hook in functional components.

Q19. write code to print pyramid pattern

Ans.

Print pyramid pattern using nested loops

  • Use nested loops to print each row of the pyramid

  • Increment spaces and decrement stars in each row

  • Example: for a pyramid with 5 rows -

  • *

  • ***

  • *****

  • *******

  • *********

Q20. What are props in react?

Ans.

Props are read-only properties that are passed from a parent component to a child component in React.

  • Props allow data to be passed between components in a unidirectional flow.

  • Props are immutable and cannot be modified by the child component.

  • Props can be used to customize the behavior or appearance of a component.

  • Props are accessed using the 'this.props' syntax in class components or as function arguments in functional components.

  • Example:

Q21. What is closure in JavaScript?

Ans.

Closure is a feature in JavaScript that allows a function to access variables from its outer scope even after the function has finished executing.

  • Closure is created when a function is defined inside another function.

  • The inner function has access to the variables and parameters of the outer function.

  • The inner function forms a closure with the outer function, preserving the state of the outer function's variables.

  • Closures are commonly used to create private variables and functi...read more

Q22. What is state in react

Ans.

State in React is a JavaScript object that stores data relevant to a component.

  • State is mutable and can be updated using the setState() method

  • State is local and specific to a component

  • Changes to state trigger re-rendering of the component

Q23. What is react why use

Ans.

React is a JavaScript library for building user interfaces.

  • React is used for creating interactive and dynamic user interfaces.

  • It allows for building reusable UI components.

  • React uses a virtual DOM for efficient rendering.

  • React can be used for single-page applications, mobile apps, and more.

Q24. What is useState?

Ans.

useState is a hook in React that allows functional components to have state.

  • useState is a built-in hook in React.

  • It allows functional components to have state.

  • It returns an array with two elements: the current state value and a function to update the state.

  • The initial state can be passed as an argument to useState.

  • The state can be of any data type, such as a string, number, boolean, or object.

  • Example: const [count, setCount] = useState(0);

Q25. lifecyle of a component

Ans.

The lifecycle of a component refers to the different stages a component goes through from creation to deletion.

  • Mounting: When a component is created and inserted into the DOM.

  • Updating: When a component's state or props change.

  • Unmounting: When a component is removed from the DOM.

  • Examples of lifecycle methods include componentDidMount, componentDidUpdate, and componentWillUnmount.

  • Lifecycle methods can be used to perform actions at specific stages of a component's lifecycle.

Q26. What are events

Ans.

Events in React are actions that occur as a result of user interaction or system events.

  • Events are used to trigger functions or actions in response to user input.

  • Examples of events include onClick, onChange, onSubmit, etc.

  • Event handlers are functions that are executed when an event is triggered.

Q27. How early can start

Ans.

The candidate can start immediately or as soon as required.

  • Candidate can start immediately if needed

  • Availability can be discussed during the interview process

  • Flexibility in start date is appreciated

Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.7k Interviews
3.8
 • 8.3k Interviews
3.6
 • 7.7k Interviews
3.7
 • 5.7k Interviews
3.7
 • 4.8k Interviews
3.7
 • 2.9k Interviews
4.0
 • 2.4k Interviews
4.0
 • 765 Interviews
3.6
 • 268 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

Reactjs 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