Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/distolma/storeon-inferno
A tiny (377 bytes) connector for Storeon and Inferno
https://github.com/distolma/storeon-inferno
Last synced: 16 days ago
JSON representation
A tiny (377 bytes) connector for Storeon and Inferno
- Host: GitHub
- URL: https://github.com/distolma/storeon-inferno
- Owner: distolma
- License: mit
- Created: 2020-04-07T12:25:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:11:41.000Z (almost 2 years ago)
- Last Synced: 2024-09-19T01:59:00.169Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 565 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Storeon Inferno
[![npm version](https://badge.fury.io/js/storeon-inferno.svg)](https://www.npmjs.com/package/storeon-inferno)
[![Build Status](https://travis-ci.org/distolma/storeon-inferno.svg?branch=master)](https://travis-ci.org/distolma/storeon-inferno)[Inferno] is the fast, React-like library for building high-performance user interfaces. `storeon-inferno` package helps to connect store with Inferno to provide a better performance and developer experience while remaining so tiny.
- **Size**. 377 bytes (+ Storeon itself) instead of ~10kB of [inferno-redux] (minified and gzipped).
- **Ecosystem**. Many additional [tools] can be combined with a store.
- **Speed**. It tracks what parts of state were changed and re-renders only components based on the changes.[storeon]: https://github.com/storeon/storeon
[tools]: https://github.com/storeon/storeon#tools
[inferno]: https://github.com/infernojs/inferno
[inferno-redux]: https://github.com/infernojs/inferno/tree/master/packages/inferno-redux
[size limit]: https://github.com/ai/size-limit
[demo]: https://codesandbox.io/s/admiring-beaver-edi8m
[article]: https://evilmartians.com/chronicles/storeon-redux-in-173-bytes## Install
```sh
npm install -S storeon-inferno
```
or
```sh
yarn add storeon-inferno
```
## How to useCreate store using `storeon` module:
#### `store.js`
```javascript
import { createStoreon } from 'storeon'let counter = store => {
store.on('@init', () => ({ count: 0 }))
store.on('inc', ({ count }) => ({ count: count + 1 }))
}export const store = createStoreon([counter])
```#### `main.js`
Provide store using `StoreonProvider` from `storeon-inferno`:
```js
import { render } from 'inferno'
import { StoreonProvider } from 'storeon-inferno'
import { store } from './store'render(
,
document.body
)
```Import `connectStoreon` decorator from `storeon-inferno`:
#### `Counter.js`
```js
import { connectStoreon } from 'storeon-inferno'const Counter = ({ count, dispatch }) => {
return (
{count}
dispatch('inc')}>inc
)
}
export default connectStoreon('count', Counter)
```