# preact-to-json

> Convert Preact components to JSON.

Latest version **1.1.2** (published 2018-01-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install preact-to-json
pnpm add preact-to-json
yarn add preact-to-json
bun add preact-to-json
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2018-01-26 |
| First published | 2017-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Neil Kistner |
| Maintainers | wyze |
| Keywords | preact, json, jest, snapshot, testing |

## Links

- npm: https://www.npmjs.com/package/preact-to-json
- Repository: https://github.com/wyze/preact-to-json
- Homepage: https://github.com/wyze/preact-to-json#readme
- Issues: https://github.com/wyze/preact-to-json/issues
- npm.io page: https://npm.io/package/preact-to-json

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.2 (latest) — 2018-01-26
- 1.1.1 — 2017-11-09
- 1.1.0 — 2017-11-09
- 1.0.2 — 2017-10-31
- 1.0.1 — 2017-05-17
- 1.0.0 — 2017-05-16

## README

# preact-to-json

[![Build Status][travis-image]][travis-url]
[![npm][npm-image]][npm-url]
[![devDependencies][depsdev-image]][depsdev-url]

> Convert [Preact](//github.com/developit/preact) components to JSON.

_**Note:** This library currently only supports shallow rendering. If you need full (non-shallow) rendering, check out [nathancahill/preact-render-to-json](//github.com/nathancahill/preact-render-to-json)._

## Installation

```sh
$ yarn add --dev preact-to-json
```

## Usage

```js
// ES6
import render from 'preact-to-json'

// ES5
const { render } = require('preact-to-json')

// With Jest
describe('Component', () => {
  it('renders', () => {
    const Component = () => (<a href="//google.com">Google</a>)
    const element = render(<Component />)

    expect(element).toMatchSnapshot()
  })
})

// test.snap
exports[`Component renders 1`] = `
<a
  href="//google.com"
>
  Google
</a>
`;
```

## Change Log

> [Full Change Log](changelog.md)

### [v1.1.2](https://github.com/wyze/preact-to-json/releases/tag/v1.1.2) (2018-01-26)

* [[`7201875d00`](https://github.com/wyze/preact-to-json/commit/7201875d00)] - Handle when null/undefined children are rendered (Neil Kistner)

## License

MIT © [Neil Kistner](https://neilkistner.com)

[travis-image]: https://img.shields.io/travis/wyze/preact-to-json.svg?style=flat-square
[travis-url]: https://travis-ci.org/wyze/preact-to-json

[npm-image]: https://img.shields.io/npm/v/preact-to-json.svg?style=flat-square
[npm-url]: https://npmjs.com/package/preact-to-json

[depsdev-image]: https://img.shields.io/david/dev/wyze/preact-to-json.svg?style=flat-square
[depsdev-url]: https://david-dm.org/wyze/preact-to-json?type=dev

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