
import React from 'react'
import { connect } from 'react-redux'

import createApp from '../../../lib'
import Counter from './components/Counter'
import counter, { increment, decrement } from './modules'

function render(Component) {
  createApp()
    .reducer(counter)
    .view(store => (
      <Component />
    )).run('#root')
}

const App = connect(
  state => ({
    value: state,
  }),
  {
    increment,
    decrement,
  },
)(Counter)

render(App)
