https://github.com/fvilers/disable-react-devtools
A simple method to disable the React Developer Tools addon to access your application
https://github.com/fvilers/disable-react-devtools
react
Last synced: 4 months ago
JSON representation
A simple method to disable the React Developer Tools addon to access your application
- Host: GitHub
- URL: https://github.com/fvilers/disable-react-devtools
- Owner: fvilers
- License: mit
- Created: 2019-02-18T07:57:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T06:34:09.000Z (over 4 years ago)
- Last Synced: 2024-11-25T18:33:19.625Z (over 1 year ago)
- Topics: react
- Language: JavaScript
- Size: 13.7 KB
- Stars: 72
- Watchers: 4
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# disable-react-devtools
A simple method to disable the React Developer Tools addon to access your application
## Support
If you use and like this library, feel free to support my Open Source projects.
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JZ26X897M9V9L¤cy_code=EUR)
## How to install
```
npm i @fvilers/disable-react-devtools
```
or
```
yarn add @fvilers/disable-react-devtools
```
## How to use
Call the `disableReactDevTools()` method before React is loaded, in your main file.
```
import React from 'react';
import ReactDOM from 'react-dom';
import { disableReactDevTools } from '@fvilers/disable-react-devtools';
import App from './App';
if (process.env.NODE_ENV === 'production') {
disableReactDevTools();
}
ReactDOM.render(, document.getElementById('root'));
```
## How it works
The `disableReactDevTools()` method will look for the React Developer Tools global hook and replace its properties and methods to prevent the plugin registration process.