React JS Interview Part-2

  • What is the difference between setState and replaceState methods?
  • How to listen to state changes?
  • What is the recommended approach of removing an array element in react state?
  • Is it possible to use React without rendering HTML?
  • How to pretty print JSON with React?
  • Why you can't update props in React?
  • How to focus an input element on page load?
  • What are the possible ways of updating objects in state?
  • How can we find the version of React at runtime in the browser?
  • What are the approaches to include polyfills in your create-react-app?
  • How to use https instead of http in create-react-app?
  • How to avoid using relative path imports in create-react-app?
  • How to add Google Analytics for react-router?
  • How to update a component every second?
  • 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?
  • Why is a component constructor called only once?
  • How to define constants in React?
  • How to programmatically trigger click event in React?
  • 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?
  • How to make AJAX call and In which component lifecycle methods should I make an AJAX call?
  • What are render props?

React Router

  • What is React Router?
  • How React Router is different from history library?
  • What are the components of React Router v4?
  • 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?

React Internationalization

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

React Testing

  • 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

React Redux

  • 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 dispatch an action on load?
  • How to use connect from React Redux?
  • How to reset state in Redux?
  • What's the purpose of at symbol in the redux connect decorator?
  • 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 to 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 an action in Redux?

Miscellaneous

  • What are the main features of reselect library?
  • Give an example of reselect usage?
  • Does the statics object work with ES6 classes in React?
  • 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 type for one prop?
  • Can I import an SVG file as react component?
  • Why are inline ref callbacks or functions not recommended?
  • What is render hijacking in React?
  • What are HOC factory implementations?
  • 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?
  • How to use class field declarations syntax in React classes?
  • 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 error boundaries do not catch errors?
  • Why do you not need error boundaries for event handlers?
  • What is the difference between try catch block and error boundaries?
  • 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 is the required method to be defined for a class component?
  • What are the possible return types of render method?
  • What is the main purpose of constructor?
  • Is it mandatory to define constructor for React component?
  • What are default props?
  • Why should not call setState in componentWillUnmount?
  • What is the purpose of getDerivedStateFromError?
  • What is the methods order when component re-rendered?
  • What are the methods invoked during error handling?
  • What is the purpose of displayName class property?
  • What is the browser support for react applications?
  • What is the purpose of unmountComponentAtNode method?
  • What is code-splitting?
  • What is the benefit of strict mode?
  • What are Keyed Fragments?
  • Does React support all HTML attributes?
  • What are the limitations with HOCs?
  • How to debug forwardRefs in DevTools?
  • When component props defaults to true?
  • What is NextJS and major features of it?
  • How do you pass an event handler to a component?
  • Is it good to use arrow functions in render methods?
  • 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 read only?
  • How do you say that state updates are merged?
  • How do you pass arguments to an event handler?
  • How to prevent component from rendering?
  • What are the conditions to safely use the index as a key?
  • Is it keys should be globally unique?
  • What is the popular choice for form handling?
  • What are the advantages of formik over redux form library?
  • Why do 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?
  • Give an example on How to use context?
  • What is the purpose of default value in context?
  • How do you use contextType?
  • What is a consumer?
  • How do you solve performance corner cases while using context?
  • What is the purpose of forward ref in HOCs?
  • Is it ref argument available for all functions or class components?
  • Why do you need additional care for component libraries while using forward refs?
  • How to create react class components without ES6?
  • Is it possible to use react without JSX?
  • What is diffing algorithm?
  • What are the rules covered by diffing algorithm?
  • When do you need to use refs?
  • Is it prop must be named as render for render props?
  • What are the problems of using render props with pure components?
  • How do you create HOC using render props?
  • 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?
  • 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 react scripts?
  • What are the features of create react app?
  • What is the purpose of renderToNodeStream method?
  • 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 does new JSX transform different from old transform?
  • How do you get redux scaffolding using create-react-app?
  • What are React Server components?
  • What is prop drilling?
  • What is state mutation and how to prevent it?
  • What is the difference between useState and useRef hook?