What are default props?

  • Props that are set by the parent component
  • Props that are passed to the component through the URL
  • Props that are assigned default values
  • Props that are passed to the component through a global store
Default props are props that are assigned default values in a React component. These default values are used if the prop is not passed to the component from the parent or if it is passed as undefined. Default props are defined using the defaultProps property on the component class.

What is windowing technique?

  • A technique for manipulating the browser window
  • A technique for optimizing performance by rendering only a subset of a large data set
  • A technique for managing React state
  • A technique for handling asynchronous data fetching
Windowing is a technique used in React to optimize performance when rendering a large data set. Windowing involves rendering only a subset of the data that is currently visible on the screen, and dynamically rendering additional data as the user scrolls or interacts with the UI. This technique can significantly improve the performance of applications that need to render large amounts of data, such as tables, lists, and grids.

How to apply validation on props in React?

  • Use the PropTypes library
  • Use the React-Validator library
  • Use the ValidateJS library
  • Use the Validation library
In React, you can apply validation to props using the PropTypes library. PropTypes allow you to define the type and shape of a component's props, which helps catch errors and bugs early in development.

How to add multiple middlewares to Redux?

  • Use the applyMiddleware() function with an array of middleware functions
  • Add each middleware function to the Redux store one at a time
  • Use the combineMiddlewares() function to combine multiple middleware functions
  • There is no way to add multiple middlewares to Redux
To add multiple middlewares to Redux, you can use the applyMiddleware() function provided by the Redux library. This function takes an arbitrary number of middleware functions as arguments and returns a single function that can be passed to the createStore() function. The applyMiddleware() function applies the middleware functions to the store in the order they are provided.

How React Router is different from history library?

  • History library is a wrapper around the React Router
  • History library is used for server-side routing and navigation
  • React Router is a wrapper around the history library
  • React Router is used for client-side routing and navigation
React Router is a higher-level abstraction on top of the history library. It provides a declarative API for routing and navigation in React applications, and manages the browser history and URL updates. The history library, on the other hand, is a low-level library that provides a simple interface for manipulating the browser history, and can be used directly in non-React applications.

Do Hooks replace render props and higher order components?

  • Hooks can only replace higher order components
  • Hooks can only replace render props
  • No, Hooks cannot replace either render props or higher order components
  • Yes, Hooks can replace both render props and higher order components
Hooks in React can replace both render props and higher order components in some cases. Hooks can provide similar functionality to both of these patterns, while also simplifying the code and making it more reusable. For example, the "useEffect" Hook can replace the "componentDidMount" and "componentDidUpdate" lifecycle methods, as well as some uses of higher order components.

What is React-Intl?

  • A library for internationalization in React
  • A library for managing state in React
  • A library for styling React components
  • A library for testing React components
React-Intl is a library for internationalization (i18n) in React applications. It provides a set of components, utilities, and formatting functions to handle different languages, locales, and cultural conventions. With React-Intl, you can easily translate text, format dates and numbers, and manage pluralization and gender.

What are the exceptions on React component naming?

  • All the options
  • Components can include numbers, but not as the first character
  • Components must be named with camelCase convention
  • Components must start with a capital letter
In React, there are several rules for naming components, including that components must start with a capital letter, use camelCase convention, and can include numbers, but not as the first character. Components should also have a descriptive name that reflects their purpose or function in the application.

What is the recommended ordering of methods in component class?

  • Constructor, event handlers, render, lifecycle methods
  • Constructor, render, lifecycle methods, event handlers
  • Lifecycle methods, constructor, render, event handlers
  • Render, constructor, lifecycle methods, event handlers
The recommended ordering of methods in a React component class is as follows: constructor, render, lifecycle methods, event handlers. This ordering groups related methods together and makes it easier to understand and maintain the code.

How to programmatically trigger click event in React?

  • Use the "document.dispatchEvent" method with a custom event
  • Use the "onClick" attribute with a function call
  • Use the "simulate" method in the "react-test-renderer" package
  • Use the "trigger" method in the "react-click-events" library
In React, you can programmatically trigger a click event by using the "simulate()" method in the "react-test-renderer" package. This method allows you to simulate a click event on a React component, and can be useful for testing or automation purposes. For example: TestRenderer.act(() => { buttonInstance.simulate('click'); });.