JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q54239F
  • License MIT

connect data-actions of preact-components via immutablejs

Package Exports

  • ipreact

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ipreact) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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