Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 1.66 KB

README.md

File metadata and controls

66 lines (46 loc) · 1.66 KB

Statemanjs logo

Integration of statemanjs for SolidJS.

import { createState } from "@persevie/statemanjs";
import { useStatemanjs } from "@persevie/statemanjs-solid";

const counterState = createState(0);

function App() {
    const count = useStatemanjs(counterState);

    return <p>Count {count}</p>;
}
import { createState } from "@persevie/statemanjs";
import { useStatemanjs } from "@persevie/statemanjs-solid";

const counterState = createState(0);

function App() {
    const evenCount = useStatemanjs(countState, {
        notifyCondition: (state) => state == 0 || state % 2 == 0,
    });

    const onClick = (): void => {
        countState.set(countState.get() + 1);
    };

    return (
        <>
            <p>Count {evenCount}</p>
            <button onClick={onClick}>Inc</button>
        </>
    );
}

Table of Contents

Installation

This integration for Solidjs requires you to install statemanjs.

npm i @persevie/statemanjs @persevie/statemanjs-solid

Detailed information about statemanjs can be found here.

For contributors

See CONTRIBUTING.md.