How should I implement in redux following logic: There a 2 actions: sync and async. Let say its validate() and save(). When user clicks buttons validate()
performed and it changes some isValid
variable in state store. Then if isValid
save action performed.
You can 'wrap' those functions in 'click handler'.
//call it on button click
handleClick = () => {
if (validate()) {
//call save function
save()
}
}
validate = () => {
//do something
//check validness and then
if (valid) return true
}