Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uppercod/preact-statenano
🔀 preact-statenano a small component for state control
https://github.com/uppercod/preact-statenano
Last synced: about 3 hours ago
JSON representation
🔀 preact-statenano a small component for state control
- Host: GitHub
- URL: https://github.com/uppercod/preact-statenano
- Owner: UpperCod
- License: gpl-3.0
- Created: 2017-11-22T15:09:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T19:59:08.000Z (over 6 years ago)
- Last Synced: 2024-10-06T22:48:05.837Z (about 1 month ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#preact-statenano
is a small library that allows to synchronize state events created on the basis of StateNano with components created with preact all thanks to the high order components.
### yarn
```bash
yarn add -D preact-statenano
```
### npm```bash
npm install -D preact-statenano
```### Provider Example
you can enter [codesandbox.io] (https://codesandbox.io/s/4xjvlqx870) to see an example of **preact-statenano** and [statenano] (https://github.com/UpperCod/statenano)
```javascript
import { h, Component, render } from "preact";
import {Provider} from 'preact-statenano';
import App from './components/App';
import Todo from './states/Todo';render(
)
```### Connect example
connect allows to generate a component that has 2 static properties:
- **with**: allows you to assign a component to the new component generated by connect
- **map**: it allows to map the new state, it must return an object```javascript
import { h, Component, render } from "preact";
import {connect} from 'preact-statenano';function Todo({state}){
returnTodo!
}return connect('todo').with(Todo).map(({todo},props)=>todo)
```