0.3.0 • Published 1 year ago

@iniz/preact v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Iniz

Iniz is a reactive store library. Try it out on our website!

npm i @iniz/preact

Build Status Test Coverage Build Size Version Downloads

Guide

@iniz/preact already re-exports @iniz/core, so don't need to install @iniz/core yourself

Simply use atom() values in components, they will re-render correctly with custom jsxImportSource.

/** @jsxImportSource @iniz/preact */
import { useAtom, useComputed, useSideEffect } from "@iniz/preact";

function MessageInput() {
  // Equivalient to `atom()`
  const counter = useAtom(10);

  // Equivalent to `computed()`
  const computedCounter = useComputed(
    () => `Computed: ${nestedCounter$$().obj.message}`
  );

  // Equivalent to `effect()`
  // NOTE: You can also use `useEffect` with atoms actually
  useSideEffect(() => {
    console.log("[Latest message] ", computedCounter());
  });

  return (
    <div>
      <button onClick={() => counter(counter() + 1)}>{counter()}++</button>
    </div>
  );
}
0.3.0

1 year ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago