Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/katilius/compose-selectors

Utility to reduce boilerplate code while using selectors together with Redux mapStateToProps
https://github.com/katilius/compose-selectors

react redux selector

Last synced: 15 days ago
JSON representation

Utility to reduce boilerplate code while using selectors together with Redux mapStateToProps

Awesome Lists containing this project

README

        

# Compose Selectors

Helper function that reduces boilerplate code needed while using selectors alongside
connect function.

```js
connect((state) => ({
firstTodo: getFirstTodo(state),
todoCount: getTodoCount(state),
currentUser: getCurrentUser(state),
notifications: getNotifications(state)
}))
```
Can be replaced with:
```js
connect(composeSelectors({
firstTodo: getFirstTodo,
todoCount: getTodoCount,
currentUser: getCurrentUser,
notifications: getNotifications
}))
```