I
I
Ignatiy22019-06-29 17:37:56
redux
Ignatiy2, 2019-06-29 17:37:56

How to get data from store in mapDispatchToProps?

There is this code:

class App extends React.Component {
  render() {
    return(
      <div>
        
      </div>
    )
  }
}

function mapStateToProps(state) {
  return {
    fruit: state.fruit,
  }
}

function mapDispatchToProps(dispatch) {
  return {
    onAddPhotos: () => {
      alert() //тут нужно взять данные из стора
    }
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(App);

How can I get data from the store here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Epifanov, 2019-06-29
@Ignatiy2

here is the answer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question