quark-store
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Quark Store

A tiny state manager for React. It uses many quark stores and direct manipulation.

Small. Between 216 bytes (minified and gzipped). Zero dependencies. It uses Size Limit to control size.

  • Fast. With small createStore and derived stores, you do not need to call the selector function for all components on every store change.
  • Tree Shakable. A chunk contains only stores used by components in the chunk.
  • Designed to move logic from components to stores.
  • Good TypeScript support.
// store/todos.ts
import { createStore } from 'quark-store';

export const $todos = createStore<Todo[]>([]);

export function addTodo(todo: Todo) {
	$todos.set([...$todos.get(), todo]);
}
import { createStore, useStore } from 'quark-store';

const $todos = createStore<Todo[]>([]);

export const Todos = () => {
	return (
		<>
			<div>
				{todos.map(todo => (
					<div key={todo.id}>{todo.label}</div>
				))}
			</div>
		</>
	);
};

Package Sidebar

Install

npm i quark-store

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

5.16 kB

Total Files

10

Last publish

Collaborators

  • ssssed