0.2.0 • Published 6 years ago

preact-statenano v0.2.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

#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

yarn add -D preact-statenano

npm

npm install -D preact-statenano

Provider Example

you can enter codesandbox.io to see an example of preact-statenano and statenano

import { h, Component, render } from "preact";
import {Provider} from 'preact-statenano';
import App   from './components/App';
import Todo  from './states/Todo';

render(
   <Provider todo={new Todo({tasks:[]})}>
       <App/>
   <Provider/>
)

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
import { h, Component, render } from "preact";
import {connect} from 'preact-statenano';

function Todo({state}){
   return <h1>Todo!</h1>
}

return connect('todo').with(Todo).map(({todo},props)=>todo)
0.2.0

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago