concept connect function in category react native
appears as: connect function

This is an excerpt from Manning's book React Native in Action.
8.6 Accessing data using the connect function
Let’s see what this means by looking at the
connectfunction you’ll use in the Books.js component.Listing 8.5
connectfunction in Books.jsconnect( (state) => { #1 return { #2 books: state.bookReducer.books } } )(Books) #3 #1 Function that gives the global Redux state object #2 Returns an object from this function #3 Passes in BooksThe first argument to
connectis a function that gives the global Reduxstateobject as an argument. You can then reference thisstateobject and have access to anything in the Redux state. You return an object from this function. Whatever keys are returned in the object become available as props in the component you’re wrapping: in this case,Books. You pass inBooksas the only argument to theconnectfunction’s second function call.