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>
</>
);
}
This integration for Solidjs requires you to install statemanjs.
npm i @persevie/statemanjs @persevie/statemanjs-solid
Detailed information about statemanjs can be found here.
See CONTRIBUTING.md.