I have a reusable component having its own action and reducer that i then use in another component.
Component AddToCart
import React, { Component } from 'react' import { bindActionCreators } from 'redux' import Button from 'environment/atoms/button' import * as AppIndexActionsCreators from 'environment/AppIndexActionsCreators' const AddToCart = (props)=>{ let boundActionCreators = bindActionCreators(AppIndexActionsCreators) return( <Button txt="Add To Cart" {...boundActionCreators} /> ) } export default AddToCart; I pass it in
import React from 'react' import { Link } from 'react-router' import ProductDesc from '../Molecules/ProductDesc' import ProductImg from 'environment/sharedMolecules/ProductImg' import AddToCart from 'environment/sharedMolecules/AddToCart' const Product = (props) => { const product = props.product; return ( <div> <Link to={`/productDesc/${product.id}`}> <ProductDesc {...props} /> <ProductImg {...props} size="small" /> </Link> <AddToCart/> </div> ) } Product.propTypes = { displayProduct: React.PropTypes.func, product: React.PropTypes.object }; On Click on AddToCart nothing happens where it should print a console.log as defined in my Reducer...when inspecting the AddToStore component in the browser i can see in the props that the component sees the AddToCart fn defined in the Action file...... looks like Action is not dispatched to the reducer...how to fix this ?
connectwrapper