Socket
Socket
Sign inDemoInstall

hydux-preact

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydux-preact

Preact renderer for hydux, hydux is an elm-like state manager inspired by Hyperapp, Elmish, Elm, Redux, etc. Working with any vdom library!


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

hydux-preact

preact renderer for hydux.

Install

yarn add hydux-preact # or npm i hydux-preact

Usage

import _app from 'hydux'
import withPreact, { h } from 'hydux-preact'

let app = withPreact()(_app)

if (process.env.NODE_ENV === 'development') {
  require('preact/debug');
  // built-in dev tools, without pain.
  const devTools = require('hydux/lib/enhancers/devtools').default
  const logger = require('hydux/lib/enhancers/logger').default
  const hmr = require('hydux/lib/enhancers/hmr').default
  app = logger()(app)
  app = devTools()(app)
  app = hmr()(app)
}

export default app({
  init: () => { count: 1 },
  actions: {
    down: () => state => ({ count: state.count - 1 }),
    up: () => state => ({ count: state.count + 1 })
  },
  view: (state: State, actions: Actions) =>
    <div>
      <h1>{state.count}</h1>
      <button onClick={actions.down}></button>
      <button onClick={actions.up}>+</button>
    </div>
})

Counter App

git clone https://github.com/hydux/hydux-preact.git
cd examples/counter
yarn # or npm i
npm start

Now open http://localhost:8080 and hack!

##` License

MIT

Keywords

FAQs

Package last updated on 23 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc