{"id":20276203,"url":"https://github.com/vanilla-icecream/reselect-computed","last_synced_at":"2026-05-10T01:02:24.679Z","repository":{"id":57354502,"uuid":"121924748","full_name":"Vanilla-IceCream/reselect-computed","owner":"Vanilla-IceCream","description":"Declaratively created computed properties for Redux and Reselect.","archived":false,"fork":false,"pushed_at":"2022-02-16T11:48:27.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-22T10:34:18.578Z","etag":null,"topics":["redux","reselect"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vanilla-IceCream.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-18T06:17:29.000Z","updated_at":"2018-06-12T06:02:09.000Z","dependencies_parsed_at":"2022-09-12T04:10:33.603Z","dependency_job_id":null,"html_url":"https://github.com/Vanilla-IceCream/reselect-computed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Freselect-computed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Freselect-computed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Freselect-computed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Freselect-computed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vanilla-IceCream","download_url":"https://codeload.github.com/Vanilla-IceCream/reselect-computed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241768281,"owners_count":20017116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["redux","reselect"],"created_at":"2024-11-14T13:12:50.313Z","updated_at":"2026-05-10T01:02:23.435Z","avatar_url":"https://github.com/Vanilla-IceCream.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reselect-computed [![Build Status](https://travis-ci.org/Vanilla-IceCream/reselect-computed.svg?branch=master)](https://travis-ci.org/Vanilla-IceCream/reselect-computed) [![Coverage Status](https://coveralls.io/repos/github/Vanilla-IceCream/reselect-computed/badge.svg?branch=master)](https://coveralls.io/github/Vanilla-IceCream/reselect-computed?branch=master)\n\nDeclaratively created computed properties for Redux and Reselect.\n\n## Installation and Usage\n\n### CJS or ESM\n\n```bash\n$ npm i reselect-computed -S\n# or\n$ yarn add reselect-computed\n```\n\n```js\n// commonjs\nconst { bindSelectCreators } = require('reselect-computed');\n\n// es modules\nimport { bindSelectCreators } from 'reselect-computed';\n```\n\n## Getting Started\n\n```js\n// types.js\n\n// @flow\n\nexport interface ICounter {\n  value: number;\n}\n\nexport interface Props {\n  counter: ICounter;\n  actions?: Object;\n  selectors?: Object;\n}\n```\n\n```js\n// constants.js\n\n// @flow\n\nimport { ICounter } from './types';\n\nexport const INITIAL: ICounter = {\n  value: 0,\n};\n```\n\n```js\n// selectors.js\n\n// @flow\n\nimport { createSelector } from 'reselect';\n\nimport { ICounter } from './types';\n\nexport const evenOrOdd = createSelector(\n  (counter: ICounter): ICounter =\u003e counter,\n  ({ value }: ICounter): string =\u003e (value % 2 === 0 ? 'even' : 'odd'),\n);\n```\n\n```js\n// Counter.js\n\n// @flow\n\nimport React from 'react';\nimport { bindActionCreators } from 'redux';\nimport { bindSelectCreators } from 'reselect-computed';\nimport { connect } from 'react-redux';\nimport { compose, lifecycle } from 'recompose';\n\nimport { Props } from './types';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\n\nexport const Counter = ({ counter, actions, selectors }: Props): React.Element\u003cProps\u003e =\u003e (\n  \u003cdiv\u003e\n    \u003cdiv className=\"typography\"\u003e\n      \u003cbutton onClick={actions.increment}\u003eIncrement\u003c/button\u003e\n      \u003cp\u003eClicked: {counter.value} times, value is {selectors.evenOrOdd}.\u003c/p\u003e\n    \u003c/div\u003e\n\n    \u003cstyle jsx\u003e{`\n      .typography {\n        padding: 0.25rem 0;\n      }\n    `}\u003c/style\u003e\n  \u003c/div\u003e\n);\n\nexport const mapStateToProps = ({ counter }) =\u003e ({\n  counter,\n  selectors: bindSelectCreators(selectors, counter),\n});\n\nexport const mapDispatchToProps = dispatch =\u003e ({\n  actions: bindActionCreators(actions, dispatch),\n});\n\nexport default compose(\n  connect(mapStateToProps, mapDispatchToProps),\n  lifecycle({\n    componentDidMount() {\n      console.log('Counter is ready.');\n    },\n  }),\n)(Counter);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanilla-icecream%2Freselect-computed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanilla-icecream%2Freselect-computed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanilla-icecream%2Freselect-computed/lists"}