# @ivi/identity

> ivi identity component.

Latest version **0.4.0** (published 2024-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ivi/identity
pnpm add @ivi/identity
yarn add @ivi/identity
bun add @ivi/identity
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2024-12-04 |
| First published | 2023-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 802 |
| Author | Boris Kaul |
| Maintainers | localvoid |
| Keywords | ivi |

## Links

- npm: https://www.npmjs.com/package/@ivi/identity
- Repository: https://github.com/localvoid/ivi
- Issues: https://github.com/localvoid/ivi/issues
- npm.io page: https://npm.io/package/@ivi/identity

## Recent versions

- 0.4.0 (latest) — 2024-12-04
- 0.4.0-beta.1 — 2024-12-02
- 0.3.1 — 2023-04-11
- 0.3.0 — 2023-04-08
- 0.2.0 — 2023-04-04
- 0.1.0 — 2023-03-19

## README

# [ivi](https://github.com/localvoid/ivi) Identity

Identity component is used to reset internal state.

## Example

```ts
import { createRoot, update, component, useState, useEffect, html } from "ivi";
import { Identity } from "@ivi/identity";

const Timer = component((c) => {
  const [time, setTime] = useState(c, 0);

  useEffect(c, () => {
    const t = setInterval(() => {
      setTime(time() + 100);
    }, 100);
    return () => { clearInterval(t); };
  })();

  return () => time();
});

const App = component((c) => {
  const [key, setKey] = useState(c, 0);

  const onClick = () => { setKey(key() + 1); };

  return () => (
    html`
    <div class="App">
      <button @click=${onClick}>Next</button>
      ${Identity({ key: key(), children: Timer() })}
    </div>
    `
  );
});

update(
  createRoot(document.body),
  App(),
);
```

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