Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lamp-luwak/lamp-luwak
Service-oriented state management for React
https://github.com/lamp-luwak/lamp-luwak
action dependency-injection dispatcher modular react-store service-architecture service-oriented state-management
Last synced: 3 months ago
JSON representation
Service-oriented state management for React
- Host: GitHub
- URL: https://github.com/lamp-luwak/lamp-luwak
- Owner: lamp-luwak
- License: mit
- Archived: true
- Created: 2018-01-31T19:55:16.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-30T05:25:11.000Z (over 2 years ago)
- Last Synced: 2024-09-26T09:23:19.359Z (3 months ago)
- Topics: action, dependency-injection, dispatcher, modular, react-store, service-architecture, service-oriented, state-management
- Language: TypeScript
- Homepage:
- Size: 2.58 MB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# lamp-luwak
> `lamp-luwak` is no longer maintained. Please use [remini](https://github.com/betula/remini) or [use-between](https://github.com/betula/use-between) instead of.
![lamp-luwak logo](./logo-sm.png)
Flexible state management for React
[![npm](https://img.shields.io/npm/v/lamp-luwak?style=flat-square)](https://www.npmjs.com/package/lamp-luwak) ![npm type definitions](https://img.shields.io/npm/types/lamp-luwak?style=flat-square) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/lamp-luwak?style=flat-square)](https://bundlephobia.com/result?p=lamp-luwak) [![build status](https://img.shields.io/github/workflow/status/betula/lamp-luwak/Tests?style=flat-square)](https://github.com/betula/lamp-luwak/actions?workflow=Tests) [![code coverage](https://img.shields.io/coveralls/github/betula/lamp-luwak?style=flat-square)](https://coveralls.io/github/betula/lamp-luwak)
### Introduction
Multistore state management with service ideology and module architecture for React. You can organize the code of your application by service-stores. Single instantiated instances of classes or function factory with a store inside at any place of your app code.
- Service-oriented and multistore architecture
- Update view components only dependent of changed stores
- No use Context API inside
- TypeScript supported
- Lightweight (~3Kb)### Install
```bash
npm i --save lamp-luwak
# or
yarn add lamp-luwak
```### Basic Usage
```typescript
import React from 'react';
import { set, useService } from 'lamp-luwak';class CounterService {
state = 0; // Initial state
increment() {
set(this, (state) => state + 1);
}
decrement() {
set(this, (state) => state - 1);
}
}const Counter = () => {
const counter = useService(CounterService);
return (
<>
counter.increment()}>+
counter.decrement()}>-
Counter: {counter.state}
>
)
};
```
[![Example on codesandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/betula/lamp-luwak/tree/master/examples/basic-usage)### Documentation
- [Getting Started](./docs/getting-started.md)
- [Core Concepts](./docs/core-concepts.md)
- [API Reference](./docs/api-reference.md)[The Russian article](https://habr.com/ru/post/497572/)
### Examples
- [Todos on CodeSandbox](https://codesandbox.io/s/github/betula/lamp-luwak/tree/master/examples/todos)
- [Server side rendering example](https://github.com/betula/lamp-luwak/tree/master/examples/ssr)### License
Lamp Luwak is [MIT licensed](./LICENSE).