# metron-jsx

> Fine grained reactivity with jsx

Latest version **0.0.2** (published 2023-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install metron-jsx
pnpm add metron-jsx
yarn add metron-jsx
bun add metron-jsx
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2023-06-28 |
| First published | 2023-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 52.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Robbie Speed |
| Maintainers | robbiespeed |

## Links

- npm: https://www.npmjs.com/package/metron-jsx
- Repository: https://github.com/robbiespeed/metron
- Homepage: https://github.com/robbiespeed/metron#readme
- Issues: https://github.com/robbiespeed/metron/issues
- npm.io page: https://npm.io/package/metron-jsx

## Dependencies (1)

- [metron-core](https://npm.io/package/metron-core.md) 0.0.2

## Recent versions

- 0.0.2 (latest) — 2023-06-28
- 0.0.1 — 2023-06-27

## README

# Metron JSX

## Install

```bash
pnpm add metron-core metron-jsx
```

Update tsconfig to use jsx runtime:

```jsonc
{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "metron-jsx/web-dom"
  }
}
```

## Usage

```tsx
import { render } from 'metron-jsx/web-dom/render.js';

const appRoot = document.querySelector('#main');

function Header() {
  return <h1>Hello World</h1>;
}

const App = (
  <div>
    <Header />
  </div>
);

render({
  root: appRoot,
  children: App,
});
```

## Examples

If you'd like more info on the reactive primitives to use checkout the Metron Core [README](https://github.com/robbiespeed/metron/blob/main/packages/core/README.md).

### Counter Component

```tsx
import { createMutatorAtom } from 'metron-core/atom.js';

function Counter() {
  const [countAtom, updateCount] = createMutatorAtom(0);
  return (
    <button on:click={() => updateCount((oldCount) => oldCount + 1)}>
      Count: {countAtom}
    </button>
  );
}
```

### Todo List

Example code can be found [here](https://github.com/robbiespeed/metron/blob/main/examples/web-todo).

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