# @chickendinosaur/react-storybook-addon-stateless

> High order stateful wrapper to help test stateless components.

Latest version **0.0.2** (published 2017-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chickendinosaur/react-storybook-addon-stateless
pnpm add @chickendinosaur/react-storybook-addon-stateless
yarn add @chickendinosaur/react-storybook-addon-stateless
bun add @chickendinosaur/react-storybook-addon-stateless
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-05-17 |
| First published | 2017-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | John Pittman |
| Maintainers | chickendinosaur |
| Keywords | react, stateful, stateless, utils, harness, storybook, addon, props |

## Links

- npm: https://www.npmjs.com/package/@chickendinosaur/react-storybook-addon-stateless
- Repository: https://github.com/chickendinosaur/react-storybook-addon-stateless
- Homepage: https://github.com/chickendinosaur/react-storybook-addon-stateless#readme
- Issues: https://github.com/chickendinosaur/react-storybook-addon-stateless/issues
- npm.io page: https://npm.io/package/@chickendinosaur/react-storybook-addon-stateless

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

- 0.0.2 (latest) — 2017-05-17
- 0.0.1 — 2017-05-11

## README

High order component generator that allows stateless components to interact with themselves.
Gives the ability to test a stateless component as if using a state management system like such as Redux.

---

# Getting Started

## Installation

### npm

npm install @chickendinosaur/react-storybook-addon-stateless

## Usage

```javascript
import generateStatelessHarness from '@chickendinosaur/react-storybook-addon-stateless';

// Stateless component.
function Counter(props) {
  return (
    <div >
      {props.value}
      <button
        onClick={() => {
          props.onClick(props.value + 1);
        }}
      / >
    </div>
  );
}

// Generate the stateful component wrapper.
const CounterComponent = generateStatelessHarness(Counter);

// The generated stateful component exposes a 'setProps' method that simulates
// the ability to update the components own props on the fly.
// Note: The callback that this.setProps is called from must not be bound to anything ex. using an arrow function
// or .bind(this). It must remain self scoped.
<CounterComponent
  value={0}
  onIncrement={function (value) {
    this.setProps({
      value
    });

    action('Increment')(value);
  }}
/>
```
---

# Development

## Installation

* git clone https://github.com/chickendinosaur/react-storybook-addon-stateless.git
* cd react-storybook-addon-stateless
* npm install

## Build

* npm run build

## Benchmarking

* npm run benchmark

## Test

* npm run test

## Publish

* npm run deploy

---

# License

The MIT License (MIT)

Copyright (c) 2016 John Pittman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the &#34;Software&#34;), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED &#34;AS IS&#34;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---
_Source: https://npm.io/package/@chickendinosaur/react-storybook-addon-stateless · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
