Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hooks support in react dev tools?

I read in the React Docs that:

React Hooks are now supported by React DevTools. They are also supported in the latest Flow and TypeScript definitions for React. We strongly recommend enabling a new lint rule called eslint-plugin-react-hooks to enforce best practices with Hooks. It will soon be included into Create React App by default.

Then I updated React to 16.8 and started using hooks. But after doing useState() and useContext() in my first component, I couldn't properly inspect them using React Dev Tools (see picture below).

Is there a way around this?

  const [loading, setLoading] = useState(false);
  const [error,setError] = useState(null);
  const [productDetails,setProductDetails] = useState(null);

  const firebase = useContext(FirebaseContext);

enter image description here

like image 260
cbdeveloper Avatar asked Mar 13 '19 17:03

cbdeveloper


People also ask

What are Hooks in React dev to?

Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This new function useState is the first “Hook” we'll learn about, but this example is just a teaser.

Which React version uses Hooks?

Hooks were added to React in version 16.8.

Can I use Hooks instead of Redux?

Redux and React Hooks should be seen as complements and also as different things. While with the new React Hooks additions, useContext and useReducer, you can manage the global state, in projects with larger complexity you can rely on Redux to help you manage the application data.

How many Hooks are there in React?

React version 18 provides 15 hooks for developers. With 15 hooks, you achieve similar functionality to a class-based component. All hooks are provided by the React team. The most common hook is useState, and other hooks are used based on the app requirements.


1 Answers

UPDATE December 2019

React Dev Tools v4 with Hooks Support has been released.

React Dev Tools - Chrome

React Dev Tools - Firefox


ORIGINAL ANSWER

The new version of the React DevTools might have already been release and that's what you should be using.

But until then, what you can use is:

https://react-devtools-experimental-chrome.now.sh/

Got this answer from one of Dan Abramov's tweets

like image 194
cbdeveloper Avatar answered Nov 03 '22 22:11

cbdeveloper