solid-hookstore

My awesome solid-hooks.

MIT License

Downloads
30
Stars
2
Committers
2

solid-hookstore

QuickStart

npm install solid-hookstore
pnpm install solid-hookstore
import {
  useLocalStorage,
  useTitle,
  createSharedValue,
  createHookStore,
  Signal,
} from "solid-hookstore";


const { defineHookStore } = createHookStore();
const useStore = defineHookStore("@title", () => {
  const initialValue = "title";
  const [a, setA] = useLocalStorage("@title", initialValue);
  const [b, setB] = useTitle(initialValue);
  const d = Signal(initialValue); // another way to use signal.

  // data binding -> merge hooks into one
  const [c, setC] = createSharedValue([a, setA], [b, setB], [d, d.set]);
  return d;
  // or use this:
  // return [c, setC];
});
import {
  useLocalStorage,
  useTitle,
  createSharedValue,
  createHookStore,
  Signal,
} from "solid-hookstore";

// to only use the basic feature
import { useLocalStorage, useTitle } from "@solid-hookstore/hooks";
import {
  createSharedValue,
  createHookStore,
  Signal,
} from "@solid-hookstore/basic";