https://github.com/matthewmueller/preact-socrates
preact plugin for socrates.
https://github.com/matthewmueller/preact-socrates
Last synced: about 1 year ago
JSON representation
preact plugin for socrates.
- Host: GitHub
- URL: https://github.com/matthewmueller/preact-socrates
- Owner: matthewmueller
- Created: 2016-03-04T07:54:47.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-04T15:34:38.000Z (about 10 years ago)
- Last Synced: 2025-04-10T09:59:41.727Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
- awesome-preact - Preact Socrates - Preact plugin for [Socrates](http://github.com/matthewmueller/socrates). (Uncategorized / Uncategorized)
README
# preact-socrates
[Preact](http://github.com/developit/preact) plugin for [socrates](http://github.com/matthewmueller/socrates).
## Install
```bash
npm install preact-socrates
```
## Example
```js
import { render, h } from 'preact-socrates'
import Logger from 'redux-logger'
import Socrates from 'socrates'
/**
* Create our virtual dom tree
*/
const Home = ({ dispatch, greeting }) => (
{ greeting }
dispatch('change greeting', { greeting: 'Hey bud' })}>Change the greeting
)
/**
* 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
*/
render(Home, store, document.body)
```
## License
MIT