ipreact
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

IPreact

connect data-actions of preact-components

Install

npm i ipreact

Usage

import IPreact from '../src/ipreact'
import { h, Component, render } from 'preact'
const { connect, dispatch, getState } = IPreact()({
    name: 'world'
})
 
const AppComponent = ({ words }) => <h2>{words}</h2>
const App = connect(() => ({
    words: `hello ${getState().name}!`
}))(AppComponent)
 
let i = 0
setInterval(function () {
    const list = ['prect', 'immutable', 'world', 'ipreact']
     i = (i + 1) % list.length
    dispatch(state => ({name: list[i]}))
}, 1000)

hello world

Package Sidebar

Install

npm i ipreact

Weekly Downloads

9

Version

0.2.3

License

MIT

Unpacked Size

17.8 kB

Total Files

12

Last publish

Collaborators

  • shy2850