React + Redux function call

2019-08-16 00:05发布

问题:

I am quite new to React + Redux and am having some issues with pretty basic stuff.

In my dropdown component I was planning to trigger two function calls but it doesn't seem to pass my data as I expected it to.

The following works properly:

onChange={this.props.handleDropdownChange}

When I console.log the action in my reducer it has the correct type, key and payload.

The following does NOT work:

onChange={(event) => { this.props.handleDropdownChange(event)}}

I end up with the correct type but the rest is now undefined. What am I doing wrong here?

Update #1 on request This is the definition of handleDropdownChange:

export const handleDropdownChange = actionCreator(DROPDOWN_HANDLER, 'event', 'key', 'payload')

actionCreator is a very basic function that simply creates an action object based on the type (a defined constant) and a dynamic list of arguments. Like I said before, it works as expected in the first example. The only thing I do then is console.log the action in my reducer.