import _app from 'hydux' import withPersist from 'hydux/lib/enhancers/persist' import withReact from 'hydux-react' import React from 'react' import { ActionsType } from 'hydux/lib/types' import withReactRouter, { ConnectedSwitch, RouterState, RouterActions } from '../../../src/index' import { Link, Route, Redirect } from 'react-router-dom' import { createHashHistory } from 'history' import Counter from './counter' import './polyfill.js' console.log('Link', Link) const history = createHashHistory() // let app = withPersist({ // key: 'time-game/v1' // })(_app) let app = withReact()(_app) app = withReactRouter(history)(app) if (process.env.NODE_ENV === 'development') { const devTools = require('hydux/lib/enhancers/devtools').default const logger = require('hydux/lib/enhancers/logger').default const hmr = require('hydux/lib/enhancers/hmr').default app = logger()(app) app = devTools()(app) app = hmr()(app) } const actions = { counter: Counter.actions } const state = { counter: Counter.init() } type Actions = typeof actions type State = typeof state const NoMatch = () =>
404
const Home = () =>
Home
const Users = () =>
Users
console.log('react', require('hydux-react')) const view = (state: RouterState) => (actions: RouterActions) => (

Router example

Home Users Accounts Counter 404 Counter.view(state.counter)(actions.counter)} />
) export default app({ init: () => state, actions, view, })