reactjs - connect react sfc component to redux and pass actions to it -


//test.js     let test=() =>{         const handleclick=()=>{             console.log(props);             this.props.addtodos('toto');// fail undefined             props.addtodos('toto'); // fail props undefined         }         return (             <div>                 <button type="submit" onclick={handleclick}  classname="btn btn-primary btn-md">submit</button>             </div>         )     }     const mapdispatchtoprops = (dispatch) => {         return {             addtodos:addtodo         }     }     test = connect(         null,         mapdispatchtoprops     )(test)     export default test;  //actions.js import { createaction } 'redux-actions'; const add_todo='add_todo'; export const addtodo = createaction(add_todo); 

i'm trying connect sfc component redux , pass actions access them it, not work. , props undefined. how can achieve ?


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -