# react-body-backgroundcolor

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

Latest version **1.2.1** (published 2018-05-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-body-backgroundcolor
pnpm add react-body-backgroundcolor
yarn add react-body-backgroundcolor
bun add react-body-backgroundcolor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2018-05-07 |
| First published | 2017-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Michiel Westerbeek |
| Maintainers | happylinks |
| Keywords | react, component, react-component, body.backgroundcolor, title, jsx |

## Links

- npm: https://www.npmjs.com/package/react-body-backgroundcolor
- Repository: https://github.com/happylinks/react-body-backgroundcolor
- Issues: https://github.com/happylinks/react-body-backgroundcolor/issues
- npm.io page: https://npm.io/package/react-body-backgroundcolor

## Dependencies (3)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.6
- [react-side-effect](https://npm.io/package/react-side-effect.md) ^1.0.0
- [create-react-class](https://npm.io/package/create-react-class.md) ^15.6.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2018-05-07
- 1.1.1 — 2018-05-07
- 1.0.1 — 2017-02-16
- 1.0.0 — 2017-02-16

## README

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](https://github.com/gaearon/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

```jsx
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.

---
_Source: https://npm.io/package/react-body-backgroundcolor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
