What are the Pointer Events supported in React?

  • Both mouse and touch events
  • Mouse events only
  • None of the above
  • Touch events only
React supports both mouse and touch events through the use of Pointer Events. Pointer Events are a standardized event model that provide a unified way to handle mouse, touch, and stylus input. React provides a set of event handlers for Pointer Events, such as "onPointerDown" and "onPointerMove", that can be used to create responsive and touch-friendly user interfaces.

Is it possible to use React without JSX?

  • Yes, JSX is optional in React
  • No, JSX is required in React
JSX is a syntax extension for JavaScript that allows developers to write HTML-like syntax in their JavaScript code. While JSX is the preferred way to write React components, it is not strictly required. React components can also be written using plain JavaScript syntax, although this can be more verbose and difficult to read. However, JSX is widely used in the React community and is considered a best practice for writing React components.

What is the difference between super() and super(props) in React using ES6 classes?

  • There is no difference, they both call the superclass constructor
  • super() calls the superclass constructor, while super(props) passes props to the constructor
  • super() is only used in functional components
  • super(props) calls the superclass constructor, while super() passes props to the constructor
In React using ES6 classes, "super()" is used to call the constructor of the superclass, while "super(props)" is used to pass props to the constructor of the superclass. The "super(props)" syntax is necessary if you need to access props in the constructor of a subclass.

What is render hijacking in React?

  • When a component's render method is called multiple times
  • When a component modifies the rendering behavior of its children
Render hijacking is a technique used in React where a component modifies the rendering behavior of its children by wrapping them in higher-order components (HOCs). This can be used to add or modify props, add event handlers, or manipulate the rendering of the children in other ways. While this can be a powerful technique, it can also lead to code that is difficult to reason about and maintain.

What is Redux DevTools?

  • A Redux middleware for handling asynchronous actions
  • A debugging tool for Redux applications
  • A UI toolkit for building web applications
  • A React component for handling forms
Redux DevTools is a browser extension and development tool that provides a visual interface for debugging and inspecting the state of a Redux application. It allows you to track and debug state changes, as well as inspect actions and reducers in real-time.

How to enable production mode in React?

  • Enable it in the browser console
  • Set the NODE_ENV environment variable to "production"
  • Use the "React.setProductionMode(true)" method
  • Use the "process.env.NODE_ENV" variable in the code
To enable production mode in React, you can set the NODE_ENV environment variable to "production". This will trigger various optimizations and remove development-only code from the bundle. You can also use the "process.env.NODE_ENV" variable in the code to conditionally enable certain features.

How to add Bootstrap to a React application?

  • Install the Bootstrap npm package and import it into your components
  • Link to the Bootstrap CSS and JavaScript files in your HTML file
  • Use a third-party React Bootstrap library
  • All of the above
There are several ways to add Bootstrap to a React application, including installing the Bootstrap npm package and importing it into your components, linking to the Bootstrap CSS and JavaScript files in your HTML file, and using a third-party React Bootstrap library.

How to define constants in React?

  • Use the "const" keyword to define constants
  • Use the "define" method to define constants
  • Use the "let" keyword to define constants
  • Use the "var" keyword to define constants
In React, you can define constants using the "const" keyword. Constants are variables that cannot be reassigned or redeclared, and are used to store values that will not change throughout the lifetime of the component. For example: const API_KEY = '12345';.

How to pretty print JSON with React?

  • Use the JSON.format() method
  • Use the JSON.parse() method
  • Use the JSON.prettify() method
  • Use the JSON.stringify() method
In React, you can pretty print JSON data by using the "JSON.stringify()" method with a "null" value for the "replacer" parameter and a number value for the "space" parameter. This will format the JSON data with indentation and line breaks for readability. For example: JSON.stringify(myData, null, 2).

What are uncontrolled components?

  • Components that are managed by React and cannot be updated directly
  • Components that are updated using refs
  • Components that are updated using the setState() method
  • Components that store their own state
Uncontrolled components are components that store their own state and are updated using refs. They are often used for simple form inputs, where managing the state in a parent component would be unnecessary overhead.