Connect Function : The connect() function connects a React component to a Redux store.
A function provided by redux which allows you to connect your react (or other framework/language) components to the redux state.
It provides its connected component with the pieces of the data it needs from the store, and the functions it can use to dispatch actions to the store.
It does not modify the component class passed to it; instead, it returns a new, connected component class that wraps the component you passed in.

Connect: Extracting Data with mapStateToProps
As the first argument passed in to connect, mapStateToProps is used for selecting the part of the data from the store that the connected component needs.
It’s frequently referred to as just mapState for short.
It is called every time the store state changes.
It receives the entire store state, and should return an object of data this component needs.

It should take a first argument called state, optionally a second argument called ownProps, and return a plain object containing the data that the connected component needs.
This function should be passed as the first argument to connect, and will be called every time when the Redux store state changes.
If you do not wish to subscribe to the store, pass null or undefined to connect in place of mapStateToProps.
It does not matter if a mapStateToProps function is written using the function keyword (function mapState(state) { } ) or as an arrow function (const mapState = (state) => { }
The mapStateToProps function should always be written with at least state passed
function mapStateToProps(state) {
const { todos } = state
return { todoList: todos.allIds }
}
export default connect(mapStateToProps)(TodoList)



Connect: Dispatching Actions with mapDispatchToProps