@cerebral/preact

Preact view for Cerebral.

Install 

npm install @cerebral/preact preact babel-preset-preact

Container 

import { h, render } from 'preact'
import App from 'cerebral'
import { Container } from '@cerebral/preact'
import AppComponent from './components/AppComponent'
import main from './main'

const app = App(main)

render(
  <Container app={app}>
    <App />
  </Container>,
  document.querySelector('#app')
)

connect 

import { h, Component } from 'preact'
import { connect } from '@cerebral/preact'
import { state, sequences } from 'cerebral'

export default connect(
  {
    foo: state`foo`,
    onClick: sequences`onClick`
  },
  class MyComponent extends Component {
    render({ foo, click }) {
      return <div onClick={() => onClick()}>{foo}</div>
    }
  }
)