F
F
ffads livd002021-02-15 10:00:32
React
ffads livd00, 2021-02-15 10:00:32

Why assign connect to a component?

I found this code in the examples, what does it mean?
I understand that mapStateToProps, mapDispatchToProps pass data to TodoList, but why assign it to VisibleTodoList?

link to source

const VisibleTodoList = connect(
  mapStateToProps,
  mapDispatchToProps
)(TodoList)

export default VisibleTodoList

And another question, where is it better to prescribe connect?
in separate files and connect there to the copconents that use this data (how to do this?) or directly in the component?
And is it possible to register several connections in one file if they have different data for transfer to props? type
connect(
  null,
  mapDispatchToProps
)(TodoList)
connect(
  mapStateToProps,
  mapDispatchToProps
)(Todo)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question