Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hand-dot/react-inspector
Easily detect React components source code from Chrome!
https://github.com/hand-dot/react-inspector
chrome-extension devtools devtools-extension react
Last synced: 16 days ago
JSON representation
Easily detect React components source code from Chrome!
- Host: GitHub
- URL: https://github.com/hand-dot/react-inspector
- Owner: hand-dot
- Created: 2022-08-30T08:02:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-13T01:58:57.000Z (over 1 year ago)
- Last Synced: 2024-10-16T14:19:04.745Z (27 days ago)
- Topics: chrome-extension, devtools, devtools-extension, react
- Language: TypeScript
- Homepage: https://chrome.google.com/webstore/detail/react-inspector/gkkcgbepkkhfnnjolcaggogkjodmlpkh
- Size: 88.9 KB
- Stars: 147
- Watchers: 4
- Forks: 12
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Inspector
YOU CAN TRY 👉 https://chrome.google.com/webstore/detail/react-inspector/gkkcgbepkkhfnnjolcaggogkjodmlpkh
Easily detect React components source code from Chrome!
![CleanShot 2022-09-02 at 18 08 23](https://user-images.githubusercontent.com/24843808/188106077-ff409aeb-0145-4977-9be2-16d04809cc78.gif)
The Inspector launch with Ctrl+Shift+X (Command+Shift+X on Mac).
You can detect and open the React component source code easily.1. Run the Dev server and Open your react app.
2. Press Ctrl+Shift+X (Command+Shift+X on Mac) on Chrome.
3. Inspect your react components and click it.---
You can edit the open in editor URL on the options page. If you are not VSCode user, you can edit it to your favorite editor URL-schemes.
![CleanShot 2022-09-12 at 13 11 18](https://user-images.githubusercontent.com/24843808/189572510-a54463ff-1f11-4c92-a19f-007ad113009b.png)
![CleanShot 2022-09-12 at 13 10 27](https://user-images.githubusercontent.com/24843808/189572514-0c7993b4-0067-4984-8ee2-89ba978907ed.png)
## Requirements
- Installed [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)
- Works only with development builds.
- Source code must be stored on local disk## How it works
The React Inspector accesses the `__REACT_DEVTOOLS_GLOBAL_HOOK__` set globally by the React Devtools and finds the [React Fiber](https://reactjs.org/docs/faq-internals.html#what-is-react-fiber) in the HTML element that the inspector hovered over.
The React Fiber contains information about the source code that will be added during development, so we use that information to open the VSCode.Reference
- https://github.com/facebook/react/tree/main/packages/react-devtools#faq
- https://babeljs.io/docs/en/babel-plugin-transform-react-jsx-source
- https://github.com/facebook/react/blob/f0efa1164b7ca8523b081223954d05c88e92053b/packages/react-reconciler/src/ReactInternalTypes.js#L193