# react-plain

> Helper functions for creating DOM elements in React without JSX

Latest version **1.0.7** (published 2019-10-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-plain
pnpm add react-plain
yarn add react-plain
bun add react-plain
```

## 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.0.7 |
| Published | 2019-10-12 |
| First published | 2019-10-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 61.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Maciej Cąderek |
| Maintainers | caderek |
| Keywords | react, html, tags, elements, create element, plain, no jsx, without jsx, components |

## Links

- npm: https://www.npmjs.com/package/react-plain
- Repository: https://github.com/caderek/react-plain
- Homepage: https://caderek.github.io/react-plain/
- Issues: https://github.com/caderek/react-plain/issues
- npm.io page: https://npm.io/package/react-plain

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.10.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2019-10-12
- 1.0.6 — 2019-10-12
- 1.0.5 — 2019-10-04
- 1.0.4 — 2019-10-03
- 1.0.3 — 2019-10-03
- 1.0.2 — 2019-10-03
- 1.0.1 — 2019-10-03
- 1.0.0 — 2019-10-03

## README

# React-plain - helper functions for creating DOM elements in React without JSX

![npm](https://img.shields.io/npm/v/react-plain)
![CircleCI](https://img.shields.io/circleci/build/github/caderek/react-plain)
![David](https://img.shields.io/david/caderek/react-plain)
![Codecov](https://img.shields.io/codecov/c/github/caderek/react-plain)
![GitHub](https://img.shields.io/github/license/caderek/react-plain)

## Table of contents

1. [Overview](#overview)
2. [Installation](#installation)
3. [Quick example](#quick-example)
4. [API](#api)
5. [License](#license)

<a id='overview'></a>

## Overview

This package contains utility functions for creating React HTML elements, without using JSX. It wraps `React.createElement` in dedicated functions for each html tag, so you have shorter syntax and IDE suggestions.

<a id='installation'></a>

## Installation

Using NPM:

```sh
npm i react-plain
```

Using Yarn:

```
yarn add react-plain
```

<a id='quick-example'></a>

## Quick example

```js
/**
 * You can also use default import, for example:
 *   import tags from 'react-plain
 *   import t from 'react-plain'
 */
import { __, a, div, h1, p } from 'react-plain'

const Hello = () => {
  return h1(__, 'Hello React without JSX!')
}

const App = () => {
  return div({ class: 'example' },
    Hello(),
    p(__, 'Simply use html tags as functions!'),
    p(__, 'You can use __ instead of null'),
    p(__,
      'Check out the project repo: ',
      a({ href: '//github.com/caderek/react-plain' }, 'click'),
    ),
  )
}
```

Live example: https://stackblitz.com/edit/react-plain-example

<a id='api'></a>

## API

API is very simple, instead of:

```js
React.createElement('tag', props, ...children)
```

you get:

```js
tag(props, ...children)
```

Additionally, the library exports `__` constant, which is just `null`, to use as a handy alternative for empty props.


<a id="license"></a>

## License

Project is under open, non-restrictive [ISC license](LICENSE).

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