React.js Questions
React.js Interview Questions & Answers
314+ questions with full answers. Scroll through all of them — more load automatically as you read.
Source: @sudheerj on GitHub
Loading questions…
React.js Questions
314+ questions with full answers. Scroll through all of them — more load automatically as you read.
Source: @sudheerj on GitHub
Loading questions…
314 questions in to do
What are the major features of React?
What is JSX?
What is the difference between an Element and a Component?
How to create components in React?
When to use a Class Component over a Function Component?
What are Pure Components?
What is state in React?
What are props in React?
What is the difference between state and props?
What is the difference between HTML and React event handling?
What are synthetic events in React?
What are inline conditional expressions?
What is "key" prop and what is the benefit of using it in arrays of elements?
What is Virtual DOM?
How Virtual DOM works?
What is the difference between Shadow DOM and Virtual DOM?
What is React Fiber?
What is the main goal of React Fiber?
What are controlled components?
What are uncontrolled components?
What is the difference between createElement and cloneElement?
What is Lifting State Up in React?
What are Higher-Order Components?
What is children prop?
How to write comments in React?
What is reconciliation?
Does the lazy function support named exports?
Why React uses `className` over `class` attribute?
What are fragments?
Why fragments are better than container divs?
What are portals in React?
What are stateless components?
What are stateful components?
How to apply validation on props in React?
What are the advantages of React?
What are the limitations of React?
What are the recommended ways for static type checking?
What is the use of `react-dom` package?
What is ReactDOMServer?
How to use innerHTML in React?
How to use styles in React?
How events are different in React?
What is the impact of indexes as keys?
How do you conditionally render components?
Why we need to be careful when spreading props on DOM elements?
How do you memoize a component?
How you implement Server Side Rendering or SSR?
How to enable production mode in React?
Do Hooks replace render props and higher order components?
What is a switching component?
What are React Mixins?
What are the Pointer Events supported in React?
Why should component names start with capital letter?
Are custom DOM attributes supported in React v16?
How to loop inside JSX?
How do you access props in attribute quotes?
What is React proptype array with shape?
How to conditionally apply class attributes?
What is the difference between React and ReactDOM?
Why ReactDOM is separated from React?
How to use React label element?
How to combine multiple inline style objects?
How to re-render the view when the browser is resized?
How to pretty print JSON with React?
Why can't you update props in React?
How to focus an input element on page load?
How can we find the version of React at runtime in the browser?
How to add Google Analytics for React Router?
How do you apply vendor prefixes to inline styles in React?
How to import and export components using React and ES6?
What are the exceptions on React component naming?
Is it possible to use async/await in plain React?
What are the common folder structures for React?
What are the popular packages for animation?
What is the benefit of styles modules?
What are the popular React-specific linters?
What is React Router?
How React Router is different from history library?
What are the `<Router>` components of React Router v6?
What is the purpose of `push()` and `replace()` methods of `history`?
How do you programmatically navigate using React Router v4?
How to get query parameters in React Router v4?
Why you get "Router may have only one child element" warning?
How to pass params to `history.push` method in React Router v4?
How to implement _default_ or _NotFound_ page?
How to get history on React Router v4?
How to perform automatic redirect after login?
What is React Intl?
What are the main features of React Intl?
What are the two ways of formatting in React Intl?
How to use `<FormattedMessage>` as placeholder using React Intl?
How to access current locale with React Intl?
How to format date using React Intl?
What is Shallow Renderer in React testing?
What is `TestRenderer` package in React?
What is the purpose of ReactTestUtils package?
What is Jest?
What are the advantages of Jest over Jasmine?
Give a simple example of Jest test case?
What is flux?
What is Redux?
What are the core principles of Redux?
What are the downsides of Redux compared to Flux?
What is the difference between `mapStateToProps()` and `mapDispatchToProps()`?
Can I dispatch an action in reducer?
How to access Redux store outside a component?
What are the drawbacks of MVW pattern?
Are there any similarities between Redux and RxJS?
How to reset state in Redux?
What is the difference between React context and React Redux?
Why are Redux state functions called reducers?
How to make AJAX request in Redux?
Should I keep all component's state in Redux store?
What is the proper way to access Redux store?
What is the difference between component and container in React Redux?
What is the purpose of the constants in Redux?
What are the different ways to write `mapDispatchToProps()`?
What is the use of the `ownProps` parameter in `mapStateToProps()` and `mapDispatchToProps()`?
How to structure Redux top level directories?
What is redux-saga?
What is the mental model of redux-saga?
What are the differences between `call()` and `put()` in redux-saga?
What is Redux Thunk?
What are the differences between `redux-saga` and `redux-thunk`?
What is Redux DevTools?
What are the features of Redux DevTools?
What are Redux selectors and why use them?
What is Redux Form?
What are the main features of Redux Form?
How to add multiple middlewares to Redux?
How to set initial state in Redux?
How Relay is different from Redux?
What is the difference between React Native and React?
How to test React Native apps?
How to do logging in React Native?
How to debug your React Native?
What is reselect and how it works?
What is Flow?
What is the difference between Flow and PropTypes?
How to use Font Awesome icons in React?
What is React Dev Tools?
Why is DevTools not loading in Chrome for local files?
How to use Polymer in React?
What are the advantages of React over Vue.js?
What is the difference between React and Angular?
Why React tab is not showing up in DevTools?
What are Styled Components?
Give an example of Styled Components?
What is Relay?
What are the main features of Reselect library?
Can Redux only be used with React?
Do you need to have a particular build tool to use Redux?
How Redux Form `initialValues` get updated from state?
How React PropTypes allow different types for one prop?
Can I import an SVG file as react component?
What is render hijacking in react?
How to pass numbers to React component?
Do I need to keep all my state into Redux? Should I ever use react internal state?
What is the purpose of registerServiceWorker in React?
What is React memo function?
What is React lazy function?
How to prevent unnecessary updates using setState?
How do you render Array, Strings and Numbers in React 16 Version?
What are hooks?
What rules need to be followed for hooks?
How to ensure hooks followed the rules in your project?
What are the differences between Flux and Redux?
What are the benefits of React Router V4?
Can you describe about componentDidCatch lifecycle method signature?
In which scenarios do error boundaries not catch errors?
What is the behavior of uncaught errors in react 16?
What is the proper placement for error boundaries?
What is the benefit of component stack trace from error boundary?
What are default props?
What is the purpose of displayName class property?
What is the browser support for react applications?
What is code-splitting?
What are Keyed Fragments?
Does React support all HTML attributes?
When component props defaults to true?
What is NextJS and major features of it?
How do you pass an event handler to a component?
How to prevent a function from being called multiple times?
How JSX prevents Injection Attacks?
How do you update rendered elements?
How do you say that props are readonly?
What are the conditions to safely use the index as a key?
Should keys be globally unique?
What is the popular choice for form handling?
What are the advantages of formik over redux form library?
Why are you not required to use inheritance?
Can I use web components in react application?
What is dynamic import?
What are loadable components?
What is suspense component?
What is route based code splitting?
What is the purpose of default value in context?
What is diffing algorithm?
What are the rules covered by diffing algorithm?
When do you need to use refs?
Must prop be named as render for render props?
What are the problems of using render props with pure components?
What is windowing technique?
How do you print falsy values in JSX?
What is the typical use case of portals?
How do you set default value for uncontrolled component?
What is your favorite React stack?
What is the difference between Real DOM and Virtual DOM?
How to add Bootstrap to a react application?
Can you list down top websites or applications using react as front end framework?
Is it recommended to use CSS In JS technique in React?
Do I need to rewrite all my class components with hooks?
What is useEffect hook? How to fetch data with React Hooks?
Is Hooks cover all use cases for classes?
What is the stable release for hooks support?
Why do we use array destructuring (square brackets notation) in `useState`?
What are the sources used for introducing hooks?
How do you access imperative API of web components?
What is formik?
What are typical middleware choices for handling asynchronous calls in Redux?
Do browsers understand JSX code?
Describe about data flow in react?
What is MobX?
What are the differences between Redux and MobX?
Should I learn ES6 before learning ReactJS?
What is Concurrent Rendering?
What is the difference between async mode and concurrent mode?
Can I use javascript urls in react16.9?
What is the purpose of eslint plugin for hooks?
What is the difference between Imperative and Declarative in React?
What are the benefits of using TypeScript with ReactJS?
How do you make sure that user remains authenticated on page refresh while using Context API State Management?
What are the benefits of new JSX transform?
How is the new JSX transform different from old transform??
What are React Server components?
What is prop drilling?
What is the difference between useState and useRef hook?
What is a wrapper component?
What are the differences between useEffect and useLayoutEffect hooks?
What are the differences between Functional and Class Components?
What is strict mode in React?
What is the benefit of strict mode?
Why does strict mode render twice in React?
What are the rules of JSX?
What is the reason behind multiple JSX tags to be wrapped?
How do you prevent mutating array variables?
What are capture phase events?
How does React batch multiple state updates?
Is it possible to prevent automatic batching?
What is React hydration?
How do you update objects inside state?
How do you update nested objects inside state?
How do you update arrays inside state?
How do you use immer library for state updates?
What are the benefits of preventing the direct state mutations?
What are the preferred and non-preferred array operations for updating the state?
What will happen by defining nested function components?
Can I use keys for non-list items?
What are the guidelines to be followed for writing reducers?
How does ReactJS work behind the scenes?
How is `useReducer` Different from `useState`?
What is useContext? What are the steps to follow for useContext?
What are the use cases of useContext hook?
When to use client and server components?
What are the differences between page router and app router in nextjs?
Can you describe the useMemo() Hook?
Can Hooks be used in class components?
What is an updater function? Should an updater function be used in all cases?
Can useState take a function as an initial value?
What types of values can `useState` hold?
What happens if you call `useState` conditionally?
Is useState Synchronous or Asynchronous?
Can you explain how useState works internally?
What is `useReducer`? Why do you use useReducer?
How does `useReducer` works? Explain with an example?
Can you combine **useReducer** with **useContext**?
Can you dispatch multiple actions in a row with useReducer?
Is dispatch from useReducer asynchronous and does it update state immediately?
How does useContext works? Explain with an example?
Can You Use Multiple Contexts in One Component?
What's a common pitfall when using useContext with objects?
What would the context value be for no matching provider?
How do reactive dependencies in the useEffect dependency array affect its execution behavior?
When and how often does React invoke the setup and cleanup functions inside a useEffect hook?
What happens if you return a Promise from useEffect??
How to prevent infinite loops with useEffect?
What are the usecases of useLayoutEffect?
How does useLayoutEffect work during server-side rendering (SSR)?
What happens if you use useLayoutEffect for non-layout logic?
How does useLayoutEffect cause layout thrashing?
How Do You Use useRef to Access a DOM Element in React? Give an example.?
Can you use useRef to persist values across renders??
Can useRef be used to store previous values?
Is it possible to access a ref in the render method?
What are the common usecases of useRef hook?
What is useImperativeHandle Hook? Give an example.?
When should you use useImperativeHandle?
Is that possible to use useImperativeHandle without forwardRef?
How is useMemo different from useCallback?
Does useMemo prevent re-rendering of child components?
What is `useCallback` and why is it used?
What are Custom React Hooks, and How Can You Develop One?
How does React Fiber works? Explain in detail.?
What is the useId hook and when should you use it?
What is the useDeferredValue hook?
What is the useTransition hook and how does it differ from useDeferredValue?
What is the useSyncExternalStore hook?
What is the useInsertionEffect hook?
How do you share state logic between components using custom hooks?
What is the useDebugValue hook?
How do you handle cleanup in useEffect?
What are the best practices for using React Hooks?
What is the purpose of callback function as an argument of `setState()`?