Usage
store.js
import { createStore } from 'redux'
function todos(state = [], action) {
switch (action.type) {
case 'ADD_TODO':
return state.concat([ action.text ])
default:
return state
}
}
export default createStore(todos, [ 'Use Redux' ])
vudux.js
import { createVudux } from 'vudux
import store from './store'
export default createVudux(store)
TodoList.vue
<template>
<ul class="todos-list">
<li class="todo" v-for="todo in todos">{{ todo }}</li>
</ul>
</template>
<script>
import vudux from './vudux'
const props = state => {
return {
todos: state.todos
}
}
export default {
mixins: [ vudux(props) ]
}
</script>