-
What is the stable release for hooks support?
React includes a stable implementation of React Hooks in 16.8 release for below packages
-
React DOM
-
React DOM Server
-
React Test Renderer
-
React Shallow Renderer
-
-
Why do we use array destructuring (square brackets notation) in
useState?When we declare a state variable with
useState, it returns a pair — an array with two items. The first item is the current value, and the second is a function that updates the value. Using [0] and [1] to access them is a bit confusing because they have a specific meaning. This is why we use array destructuring instead.For example, the array index access would look as follows:
var userStateVariable = useState('userProfile'); // Returns an array pair var user = userStateVariable[0]; // Access first item var setUser = userStateVariable[1]; // Access second itemWhereas with array destructuring the variables can be accessed as follows:
const [user, setUser] = useState('userProfile'); -
What are the sources used for introducing hooks?
Hooks got the ideas from several different sources. Below are some of them,
-
Previous experiments with functional APIs in the react-future repository
-
Community experiments with render prop APIs such as Reactions Component
-
State variables and state cells in DisplayScript.
-
Subscriptions in Rx.
-
Reducer components in ReasonReact.
-
-
How do you access imperative API of web components?
Web Components often expose an imperative API to implement its functions. You will need to use a ref to interact with the DOM node directly if you want to access imperative API of a web component. But if you are using third-party Web Components, the best solution is to write a React component that behaves as a wrapper for your Web Component.
-
What is formik?
Formik is a small react form library that helps you with the three major problems,
-
Getting values in and out of form state
-
Validation and error messages
-
Handling form submission
-
-
What are typical middleware choices for handling asynchronous calls in Redux?
Some of the popular middleware choices for handling asynchronous calls in Redux eco system are
Redux Thunk, Redux Promise, Redux Saga. -
Do browsers understand JSX code?
No, browsers can't understand JSX code. You need a transpiler to convert your JSX to regular Javascript that browsers can understand. The most widely used transpiler right now is Babel.
-
Describe about data flow in react?
React implements one-way reactive data flow using props which reduce boilerplate and is easier to understand than traditional two-way data binding.
-
What is react scripts?
The
react-scriptspackage is a set of scripts from the create-react-app starter pack which helps you kick off projects without configuring. Thereact-scripts startcommand sets up the development environment and starts a server, as well as hot module reloading. -
What are the features of create react app?
Below are the list of some of the features provided by create react app.
-
React, JSX, ES6, Typescript and Flow syntax support.
-
Autoprefixed CSS
-
CSS Reset/Normalize
-
A live development server
-
A fast interactive unit test runner with built-in support for coverage reporting
-
A build script to bundle JS, CSS, and images for production, with hashes and sourcemaps
-
An offline-first service worker and a web app manifest, meeting all the Progressive Web App criteria.
-