# nanojsx-hooks

> Experimental hooks with [nanojsx](https://nanojsx.io).

Latest version **0.0.1** (published 2022-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install nanojsx-hooks
pnpm add nanojsx-hooks
yarn add nanojsx-hooks
bun add nanojsx-hooks
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2022-06-17 |
| First published | 2022-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Maintainers | herudi |

## Links

- npm: https://www.npmjs.com/package/nanojsx-hooks
- Repository: https://github.com/herudi/nanojsx-hooks
- Homepage: https://github.com/herudi/nanojsx-hooks#readme
- Issues: https://github.com/herudi/nanojsx-hooks/issues
- npm.io page: https://npm.io/package/nanojsx-hooks

## Recent versions

- 0.0.1 (latest) — 2022-06-17
- 0.0.0 — 2022-06-15

## README

## Nanojsx Hooks

Experimental hooks with [nanojsx](https://nanojsx.io).

[![codecov](https://codecov.io/gh/herudi/nanojsx-hooks/branch/master/graph/badge.svg)](https://codecov.io/gh/herudi/nanojsx-hooks)

## Hooks

- useState
- useEffect
- useReducer
- useMemo
- useCallback
- useRef
- useContext

## Install
```bash
npm i nanojsx-hooks
```
## Usage
```jsx
/** @jsx h */
import { h, render } from "nano-jsx";
import { Hooked, useEffect, useState } from "nanojsx-hooks";

// deno
// import { Hooked, useEffect, useState } from "https://deno.land/x/nanojsx_hooks/mod.ts";

function Counter() {
  const [count, setCount] = useState(0);

  useEffect(() => {
    // log
    console.log(count);
  }, [count]);
  
  return (
    <div>
      <button
        onClick={() => {
          setCount(count + 1);
        }}
      >
        Increment
      </button>
      <h1>Counter: {count}</h1>
    </div>
  );
}

Hooked.bind(render)(Counter, document.getElementById("app"));

// ssr
// const str = Hooked.bind(renderSSR)(Counter);
// console.log(str)

```

## Example Usage

```bash
git clone https://github.com/herudi/nanojsx-hooks.git

cd nanojsx-hooks

deno task dev
```

> Hot-reloading support. just edit file in src folders.

## Build (Node.js)

```bash
git clone https://github.com/herudi/nanojsx-hooks.git

cd nanojsx-hooks

npm i

npm run build
```

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