Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does React Developer Tools determine that the webpage is using React?

I found this link for determining that a webpage is using angular

Tried doing the same thing for React, but there is no object displayed in console.

Any idea on how it works?

Thanks in advance

like image 292
Harsh Pancholi Avatar asked Oct 18 '17 10:10

Harsh Pancholi


People also ask

What do the React developer tools show us?

React Developer Tools is a Chrome DevTools extension for the open-source React JavaScript library. It allows you to inspect the React component hierarchies in the Chrome Developer Tools. You will get two new tabs in your Chrome DevTools: "⚛️ Components" and "⚛️ Profiler".

How do you identify a project React?

The other method is also straightforward, you can check the React app version by heading over to node_modules/react/cjs/react. development. js. You can see the react project version in the commented section as showing given below.

How do I use React Web developer tools?

Opening React Dev Tools To open the extension. Right-click anywhere in the browser window and click on Inspect. Additionally, you can open it by pressing F12. This will open browser developer tools with all the usual tabs like Elements, Console, etc.


1 Answers

According to the react-devtools FAQ:

When the page loads, the devtools sets a global named __REACT_DEVTOOLS_GLOBAL_HOOK__, then React communicates with that hook during initialization.

It appears others have found this as well, and someone asked how to prevent your production React app from working with React Devtools: https://stackoverflow.com/a/39152804/368697

like image 128
Ross Allen Avatar answered Sep 16 '22 19:09

Ross Allen