How do I access the function, props.change()?

245 Views Asked by At

I would like to use the answer suggested here: https://stackoverflow.com/a/51065315/9973545 which involves doing

this.props.change('_validationHack', Date.now())

"in the reduxForm-wrapped component". My this.props has no change function in it, though.

I'm attempting to access the function from inside my render function which (heavily pared down) says something like:

render() {
    return (<button title="Hello, World" type="Submit" 
          onMouseDown={() => this.props.change('_validationHack', Date.now())}
          onClick={(event) => doWork(event)}
          id="my-button">
              my-button
    </button>)
}

I assume I'm using the wrong props, but I'm not sure what other props I have. Or perhaps I need to use another library to further decorate my props?

1

There are 1 best solutions below

0
On BEST ANSWER

The context in which I was making the call was incorrect, so I didn't have access to the change function. Instead, I wound up passing an helper function, prepareValidate, to the component so that change could be called in a parent context.