All Projects → dottostack → dotto.x

dottostack / dotto.x

Licence: MIT License
A tiny state manager for React, Svelte, Vue and vanilla JS

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to dotto.x

Xsm
State Management made eXtraordinarily simple and effective for Angular, React, and Vue
Stars: ✭ 138 (+32.69%)
Mutual labels:  state-management, svelte
ngx-model-hacker-news-example
Example repository with Hacker News implementation using Angular, Angular Material & ngx-model
Stars: ✭ 27 (-74.04%)
Mutual labels:  state-management
svelte-trivia
A Quiz app completely made using Svelte
Stars: ✭ 25 (-75.96%)
Mutual labels:  svelte
xstate-viz
Visualizer for XState machines
Stars: ✭ 274 (+163.46%)
Mutual labels:  state-management
sveltober
Cybernetically enhanced October applications
Stars: ✭ 19 (-81.73%)
Mutual labels:  svelte
memento-svelte-electron-typescript
Template to create a desktop app with Svelte, TailwindCSS, Electron and TypeScript (with electron-updater, electron-reload and electron-builder)
Stars: ✭ 27 (-74.04%)
Mutual labels:  svelte
flutter modularization
[Flutter SDK V.2] - This repo will introduce you how to mastering your app with implementation Flutter Modularization in several ways
Stars: ✭ 78 (-25%)
Mutual labels:  state-management
flutter-bloc-patterns
A set of most common BLoC use cases built on top of flutter_bloc library
Stars: ✭ 58 (-44.23%)
Mutual labels:  state-management
svelte-style-directive
A custom Svelte preprocessor to add support for style directive.
Stars: ✭ 19 (-81.73%)
Mutual labels:  svelte
blockhead
Crypto portfolio tracker, DeFi dashboard, NFT viewer and data explorer for the Ethereum/EVM-based blockchain ecosystem and the web 3.0-powered metaverse https://gitcoin.co/grants/2966/blockhead
Stars: ✭ 41 (-60.58%)
Mutual labels:  svelte
svelte-generic-crud-table
Agnostic web-component for object-arrays with CRUD functionality.
Stars: ✭ 38 (-63.46%)
Mutual labels:  svelte
svelte-fast-dimension
Fast dimension bindings using ResizeObservers
Stars: ✭ 23 (-77.88%)
Mutual labels:  svelte
svelte-hamburgers
Custom Hamburger Icons in Svelte with ease
Stars: ✭ 27 (-74.04%)
Mutual labels:  svelte
rxdeep
rxjs deep state management
Stars: ✭ 47 (-54.81%)
Mutual labels:  state-management
svelvg
Convert SVG files into Svelte components with TypeScript definitions
Stars: ✭ 19 (-81.73%)
Mutual labels:  svelte
juliette
Reactive State Management Powered by RxJS
Stars: ✭ 84 (-19.23%)
Mutual labels:  state-management
svelte-router
Router component for Svelte
Stars: ✭ 63 (-39.42%)
Mutual labels:  svelte
http-interceptors
The Web apps in this monorepo make HTTP requests and require uniform consistency in how they are executed and handled. This monorepo demonstrates the same app written with Angular and with Svelte. Each app uses HTTP interceptors. The Angular app uses HttpClient and its interceptors while the Svelte app uses Axios and its interceptors.
Stars: ✭ 46 (-55.77%)
Mutual labels:  svelte
xstate-cpp-generator
C++ State Machine generator for Xstate
Stars: ✭ 33 (-68.27%)
Mutual labels:  state-management
Vuex-Alt
An alternative approach to Vuex helpers for accessing state, getters and actions that doesn't rely on string constants.
Stars: ✭ 15 (-85.58%)
Mutual labels:  state-management

dotto.x

dotto.x - lightweight state manager

Dotto.x is a tiny state manager for React, Svelte, and vanilla JS.

  • Lightweight. Core is less than 135 bytes (minified and gzipped). Zero dependencies.
  • Easy but strong. Simple working principle without magic but with all features from big state managers.
  • Deep observable. You can subscribe and follow pinpoint changes without thinking about multiple re-renders and memoization.
  • Strong plugin system. You can enhance your store with plugins. Logging, undoing changes, connecting Redux-devtools, and anything else.
  • Tree Shakable. All library is split into small modules.
  • Strong TypeScript support.



Status

⚠️ ⚠️ ⚠️

Project is in progress now. Please wait for version 1.0.0.

TODOS

  • Documentation
  • JSDoc comments
  • Vue, RN, Solid bindings
  • Examples on all frameworks

Installation

Using npm

npm i dotto.x

Using yarn

yarn add dotto.x

Basic usage

Atomic stores

import { createAtom } from 'dotto.x'

const userName = createAtom('John')

userName.listen(value => {
  // do something
})

userName.set('John Constantine')

Mutable stores

import { createStore } from 'dotto.x'

const user = createStore({ name: 'John' })

user.watch('name', value => {
  // do something
})

userName.set('name', 'John Constantine')

Computed

Combine your stores

Subscribe to store or part of stores using take.

import { createStore, computed, take } from 'dotto.x'

const user = createStore({ name: 'John', id: 'some_id' })
const projects = createStore({
  some_id: { name: 'Portfolio' },
  some_other_id: { name: 'Awesome Project' }
})

const targetProject = computed(() => {
  let userId = take(user, 'id')
  return take(projects, userId)
})

targetProject.subscribe(value => /* do something */)

user.set('id', 'some_other_id')

Computed operators

take

  • get value and subscribe to this paths

deep

  • get value and subscribe to all store

Use with React

Install dotto.x binding to React:

Using npm

npm i @dotto.x/react

Using yarn

yarn add @dotto.x/react

store.js

import { createStore, computed, take, update } from 'dotto.x'

const user = createStore({ name: 'John', id: 'some_id' })
const projects = createStore({
  some_id: { name: 'Portfolio' },
  some_other_id: { name: 'Awesome Project' }
})

export const targetProject = computed(() => {
  let userId = take(user, 'id')
  return take(projects, userId)
})

export const changeUser = newUser => {
  return update(user, () => newUser)
}

ProjectCard.jsx

import { useStore } from '@dotto.x/react'
import { targetProject } from './store'

export const ProjectCard = () => {
  const project = useStore(targetProject)
  return <div>{project.name}</div>
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].