0.0.4 • Published 2 years ago

@dimensionhq/solid-recoil v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Solid Recoil

The state management for Solid.

Getting started is easy!

# npm
npm i @dimensionhq/solid-recoil

# yarn
yarn add @dimensionhq/solid-recoil

# pnpm
pnpm i @dimensionhq/solid-recoil

Atoms

Think of atoms as storage containers each container has its own definite set of properties (key, default etc).

import {atom, useRecoilState, useRecoilValue, useRecoilLoadingValue} from "@dimensionhq/solid-recoil"

const todoState = atom({
    default: [], 
    key: 'todoList';
})

// for setting todos you can use useRecoilState
const [todo, setTodo] = useRecoilState(todoState)

// for getting / subscribing for a value you can use
const todo = useRecoilValue(todoState)


const f = async () => {
    await sleep(2000);
    return 'asd';
};

// for updating state after an async function has completed
const todo = useRecoilLoadingValue(todoState, f);
0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago