vue redux binding higher order component
Vue Redux is tested to work on vue v2 and should be used with vue-jsx or in component template string. For more on vue-jsx https://github.com/vuejs/babel-plugin-transform-vue-jsx
Install
install through npm i redux-vue --save
Initialize
install in your root component
// main.js;;;; // install redux-vueVue; store: AppStore { return <App /> };
// store.js; const initialState = todos: ; const reducer = { } const AppStore = ; ;
Use in your component
// components/App.js ; const App = props: todos: type: Array addTodo: type: Function methods: { const todo = this$refsinputvalue; this; } { return <div> <ul> thistodos </ul> <div> <input type="text" ref="input" /> <button on-click=thishandleAddTodo>add todo</button> </div> </div> }; { return todos: statetodos ;} { return { } } mapStateToProps mapActionToPropsApp;