react-no-sleep
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

react-no-sleep

headless component to keep browser awake

NPM JavaScript Style Guide

Install

npm install --save react-no-sleep

Usage

import * as React from 'react';
 
import ReactNoSleep from 'react-no-sleep';
 
class Example extends React.Component {
  render() {
    return (
      <ReactNoSleep>
        {({ isOn, enable, disable }) => (
          <button onClick={isOn ? disable : enable}>
            {isOn ? 'on' : 'off'}
          </button>
        )}
      </ReactNoSleep>
    );
  }
}

License

MIT © malcolm-kee

/react-no-sleep/

    Package Sidebar

    Install

    npm i react-no-sleep

    Weekly Downloads

    9

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    66.4 kB

    Total Files

    8

    Last publish

    Collaborators

    • malcolmkee