# react-cxs-hoc

> React higher order component for cxs

Latest version **3.0.3** (published 2017-01-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-cxs-hoc
pnpm add react-cxs-hoc
yarn add react-cxs-hoc
bun add react-cxs-hoc
```

## 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 | 3.0.3 |
| Published | 2017-01-05 |
| First published | 2016-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brent Jackson |
| Maintainers | jxnblk |
| Keywords | react, react-component, higher-order-component, css, cxs, css-in-js |

## Links

- npm: https://www.npmjs.com/package/react-cxs-hoc
- npm.io page: https://npm.io/package/react-cxs-hoc

## Dependencies (2)

- [cxs](https://npm.io/package/cxs.md) ^3.0.1
- [classnames](https://npm.io/package/classnames.md) ^2.2.5

## 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

- 3.0.3 (latest) — 2017-01-05
- 3.0.2 — 2017-01-05
- 1.0.0-beta.1 — 2016-07-31

## README

# ϟ react-cxs-hoc

React higher order component for applying CSS style objects to components with [cxs](https://github.com/jxnblk/cxs)

```sh
npm i react-cxs-hoc
```

## Higher order component

```jsx
// Example HOC usage
import React from 'react'
import withCxs from 'react-cxs-hoc'

const Box = props => <div {...props} />

export default withCxs(Box)
```

```jsx
// Example Grid component
import React from 'react'
import Box from './Box'

const Grid = ({
width = 1 / 2,
...props
}) => {
  const css = {
    boxSizing: 'border-box',
    display: 'inline-block',
    verticalAlign: 'top',
    paddingLeft: 32,
    paddingRight: 32,
    width: `${width * 100}%`
  }

  return <Box {...props} css={css} />
}

export default Grid
```

## Base component

```jsx
import React from 'react'
import { Base } from 'react-cxs-hoc'

const Button = ({ css = {}, ...props }) => {
  const css = {
    fontFamily: 'inherit',
    fontSize: 'inherit',
    display: 'inline-block',
    margin: 0,
    padding: 8,
    color: '#fff',
    backgroundColor: '#07c',
    borderRadius: 2,
    WebkitAppearance: 'none',
    MozAppearance: 'none',
    ':hover': {
      backgroundColor: '#06b'
    },
    ...css
  }

  return <Base {...props} tag='button' css={css} />
}
```

### Related:

- [cxs](https://github.com/jxnblk/cxs)
- [cxs-components](https://github.com/jxnblk/cxs/tree/master/packages/cxs-components)
- [react-cxs](https://github.com/jxnblk/cxs/tree/master/packages/react-cxs)

[MIT License](LICENSE.md)

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