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);
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.
Hooks were added to React in version 16.8.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With