All Projects → fvilers → disable-react-devtools

fvilers / disable-react-devtools

Licence: MIT license
A simple method to disable the React Developer Tools addon to access your application

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

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.

donate

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(<App />, 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].