reactjs - Pass a connected component into React Route causing error -
when pass connected component export default connect(componentname) react route route code below,
<route path={path} component={componentname}/> i following errors,
you must pass component function returned connect. instead received {"match":{"path":"/:code","url":"/sample- code","isexact":true,"params":{"code":"sample-code"}},"location": {"pathname":"/sample-code","search":"","hash":""},"history": {"length":40,"action":"pop","location":{"pathname":"/sample- code","search":"","hash":""}}} can pass connected component route component?
connect take arguments functions mapstatetoprops. meant connect()(componentname).
you can pass connected component route component prop, no need use render prop.
Comments
Post a Comment