# react-jss-hook

> A react hook for using jss styles

Latest version **0.0.6** (published 2018-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-jss-hook
pnpm add react-jss-hook
yarn add react-jss-hook
bun add react-jss-hook
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2018-11-03 |
| First published | 2018-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Henri Beck |
| Maintainers | henribeck |

## Links

- npm: https://www.npmjs.com/package/react-jss-hook
- Repository: https://github.com/cssinjs/react-jss-hook
- npm.io page: https://npm.io/package/react-jss-hook

## Dependencies (5)

- [jss](https://npm.io/package/jss.md) ^9.8.7
- [theming](https://npm.io/package/theming.md) ^2.1.2
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.1.2
- [@babel/polyfill](https://npm.io/package/@babel/polyfill.md) ^7.0.0
- [jss-preset-default](https://npm.io/package/jss-preset-default.md) ^4.5.0

## Recent versions

- 0.0.6 (latest) — 2018-11-03
- 0.0.5 — 2018-11-03
- 0.0.4 — 2018-11-02
- 0.0.3 — 2018-11-02
- 0.0.2 — 2018-11-02
- 0.0.1 — 2018-11-02

## README

# react-jss-hook
A experimental react hook for using jss styles

## Installation

> yarn add react-jss-hook

## Usage

```js
import createUseStyles, { 
  JssContext,
  ThemeProvider,
} from 'react-jss-hook';
import jss from 'jss';

const useStyles = createUseStyles((theme) => ({
  button: { 
    color: 'red',
    fontSize: theme.fontSize,
    backgroundColor: data => data.bg,
  },
}));

type Props = { bg: string };

function Button(props: Props) {
  const classes = useStyles(props);
  
  return (
    <button className={classes.button}>
      {props.children}
    </button>
  );
}

function App() {
  return (
    <JssContext value={{ jss: jss }}>
      <ThemeProvider theme={{ fontSize: 16 }}>
        <Button bg="black">
          Hello
        </Button>
      </ThemeProvider>
    </JssContext>
  );
}
```

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