Skip to content
preact plugin for socrates.
JavaScript Makefile
Branch: master
Clone or download
Latest commit fe48e20 Apr 4, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib export preact's Component Apr 4, 2016
.gitignore Initial commit Mar 4, 2016
.npmignore Initial commit Mar 4, 2016
History.md Release 1.0.2 Apr 4, 2016
Makefile Initial commit Mar 4, 2016
Readme.md fix example Mar 17, 2016
package.json Release 1.0.2 Apr 4, 2016

Readme.md

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

You can’t perform that action at this time.