react-is-dev

A simple library to determine whether a react app is under development or production environment

Usage no npm install needed!

<script type="module">
  import reactIsDev from 'https://cdn.skypack.dev/react-is-dev';
</script>

README

Build Status Coverage Status

Description

The library provides a single function to determine the environment under which a react app is started. The function returns true in case of react development server, false in case of built application.

Tested with create-react-app.

Installation

npm i react-is-dev

Import

import isDev from 'react-is-dev';

Usage

isDev is a simple function returning Boolean value and accepting your React instance as a parameter.

So, to determine whether your app is under development or production enviroment, use:

import React from 'react';
...
import isDev from 'react-is-dev';
...
...
const ifDevEnv = isDev(React); // true if development mode, false if production