0

I can not figure out how to assign a value to Raect element and pass it to state as props after clicking. The code is:

const mapDispatchToProps = (dispatch) => {
    return {
        contributionValue: (e) => dispatch(selectType(e.target.value))
    }
}

and the render part is

render() {
        return(
            <Container>
                <Option1 value='single' onClick={this.props.contributionValue}>
                    <Image src={Icon1}/>
                    <Text>Chcem finančne prispieť konkrétnemu útulku</Text>
                </Option1>
                <Option2 value='whole' onClick={this.props.contributionValue}>
                    <Image src={Icon2}/>
                    <Text>Chcem finančne prispieť celej nadácii</Text>
                </Option2>
            </Container>
        )
    }

My target value is always undefined, dont know how to set and assign this value (or any value for that matter) after clicking on element. Apparently the value I have set for each element is not being passed when clicked. I need storing single or whole to contributionValue based on which one is clicked.

Any ideas?

martinK
  • 93
  • 1
  • 9

0 Answers0