Necessitates Proper Modularity
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

preact-socrates

1.0.2 • Public • Published

preact-socrates

Preact plugin for socrates.

Install

npm install preact-socrates

Example

import { render, h } from 'preact-socrates'
import Logger from 'redux-logger'
import Socrates from 'socrates'
 
/**
 * Create our virtual dom tree
 */
 
const Home = ({ dispatch, greeting }) => (
  <div class='home'>
    <h2>{ greeting }</h2>
    <button onClick={(e) => dispatch('change greeting', { greeting: 'Hey bud' })}>Change the greeting</button>
  </div>
)
 
/**
 * Initialize our store
 */
 
let store = Socrates([
  Logger()
])
 
/**
 * Initial application state
 */
 
store('boot', {
  greeting: 'Welcome to the website, friend!'
})
 
/**
 * Render our virtual dom tree to the <body>
 */
 
render(Home, store, document.body)

License

MIT

install

npm i preact-socrates

Downloadsweekly downloads

1

version

1.0.2

license

none

repository

githubgithub

last publish

collaborators

  • avatar