Socket
Socket
Sign inDemoInstall

react-body-backgroundcolor

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-body-backgroundcolor

A declarative, nested way to manipulate your body's backgroundcolor


Version published
Weekly downloads
59
decreased by-64.24%
Maintainers
1
Weekly downloads
 
Created
Source

React Body Backgroundcolor

Provides a declarative way to specify document.body.style.backgroundcolor in a single-page app. This component can be used on server side as well.

Built with React Side Effect.

====================

Installation

npm install --save react-body-backgroundcolor

Dependencies: React >= 0.13.0

Features

  • Does not emit DOM, not even a <noscript>;
  • Like a normal React compoment, can use its parent's props and state;
  • Can be defined in many places throughout the application;
  • Works just as well with isomorphic apps.

Example

class SomeComponent {
  render() {
    return (
      <BodyBackgroundColor backgroundColor='#FF00FF'>
        <h1>Home, sweet home.</h1>
      </BodyBackgroundColor>
    );
  }
}

Server Usage

If you use it on server, call BodyBackgroundColor.rewind() after rendering components to string to retrieve the color. You can then embed this color into HTML page template.

Because this component keeps track of mounted instances, you have to make sure to call rewind on server, or you'll get a memory leak.

Keywords

FAQs

Package last updated on 16 Feb 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc