Skip to content

crystalbit/react-is-dev

Repository files navigation

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

About

Simple library to determine whether react app is run via development server or production

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published