Socket
Socket
Sign inDemoInstall

reakit-warning

Package Overview
Dependencies
7
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    reakit-warning

Reakit warning


Version published
Weekly downloads
113K
increased by3.82%
Maintainers
1
Install size
234 kB
Created
Weekly downloads
 

Readme

Source

reakit-warning

NPM version

This is experimental and may have breaking changes in minor versions.

Installation

npm:

npm i reakit-warning

Yarn:

yarn add reakit-warning

Reducing bundle size

Literal strings aren't minified. Keeping them in your production bundle may increase the bundle size significantly.

To prevent that, you should:

  1. Put reakit-warning/babel-plugin into your babel config.

    This will make sure your warning and useWarning calls are wrapped within a condition that checks if process.env.NODE_ENV !== 'production'.

  2. Use UglifyJS, Terser or any other JavaScript parser that performs dead code elimination. This is usually used in conjunction with JavaScript bundlers, such as webpack.

    When parsing the code in production mode, the warning call will be removed altogether.

API

Table of Contents

useWarning

Logs messages to the console using console.warn based on a condition. This should be used inside components.

Parameters

warning

Logs messages to the console using console.warn based on a condition.

Parameters
Examples
import { warning } from "reakit-warning";

warning(true, "a", "b"); // console.warn("a", "\n", "b")
warning(false, "a", "b"); // does nothing

License

MIT © Diego Haz

Keywords

FAQs

Last updated on 06 Sep 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc