{"id":22478293,"url":"https://github.com/zanettin/incompose","last_synced_at":"2025-08-02T13:31:45.866Z","repository":{"id":57273302,"uuid":"80930682","full_name":"zanettin/incompose","owner":"zanettin","description":"A inferno utility belt for function components and higher-order components","archived":false,"fork":false,"pushed_at":"2019-07-06T14:25:01.000Z","size":452,"stargazers_count":78,"open_issues_count":2,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-14T10:44:41.336Z","etag":null,"topics":["functional-components","functional-programming","higher-order-component","hoc","inferno","inferno-js","javascript","npm","npm-package","recompose"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zanettin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-04T16:08:09.000Z","updated_at":"2023-10-17T08:15:05.000Z","dependencies_parsed_at":"2022-09-17T02:00:35.796Z","dependency_job_id":null,"html_url":"https://github.com/zanettin/incompose","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanettin%2Fincompose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanettin%2Fincompose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanettin%2Fincompose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanettin%2Fincompose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zanettin","download_url":"https://codeload.github.com/zanettin/incompose/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228476441,"owners_count":17926223,"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":["functional-components","functional-programming","higher-order-component","hoc","inferno","inferno-js","javascript","npm","npm-package","recompose"],"created_at":"2024-12-06T14:26:16.286Z","updated_at":"2024-12-06T14:26:17.038Z","avatar_url":"https://github.com/zanettin.png","language":"JavaScript","readme":"![Inferno JS Logo](https://cdn-images-1.medium.com/max/1600/1*NZoKqwcj_x9W1Zh-eWWeCw.png \"Inferno JS\")\n\n# Incompose\nIncompose is a [Inferno.js](https://infernojs.org/) clone of the famous [recompose](https://github.com/acdlite/recompose) lib for React.\n\n[![Build Status](https://semaphoreci.com/api/v1/open-source/incompose/branches/master/shields_badge.svg)](https://semaphoreci.com/open-source/incompose) \n[![npm version](https://badge.fury.io/js/incompose.svg)](https://www.npmjs.com/package/incompose) \n[![npm downloads](https://img.shields.io/npm/dm/incompose.svg?style=flat-square)](https://www.npmjs.com/package/incompose) \n[![Code Climate](https://codeclimate.com/github/zanettin/incompose/badges/gpa.svg)](https://codeclimate.com/github/zanettin/incompose) \n[![Test Coverage](https://codeclimate.com/github/zanettin/incompose/badges/coverage.svg)](https://codeclimate.com/github/zanettin/incompose/coverage) \n[![MIT](https://img.shields.io/npm/l/express.svg)](LICENSE.md)\n\n## Installation\n```\nnpm install incompose\n```\n\n## Incompose / Inferno version map\nIncompose works with specific version of inferno. Please make sure you use the correct version.\n\n| Inferno verion | Incompose version |\n| -- | -- |\n| `v7.x` | `\u003e= v.5.0.0` |\n| `v6.x` | `\u003e= v.4.0.0` |\n| `v5.x` | `\u003e= v.3.0.0` |\n| `v4.x` | `v.2.0.0` |\n| `\u003c v4.0` | `\u003c v.2` |\n\n## Support\nFollowing HoCs are available. If you miss any helper/HoC please send me a note on twitter [@roman_zanettin](https://twitter.com/roman_zanettin) or create an issue / open a PR. Thanks.\n\n| Function | since |\n| --- | :---: |\n|[branch](docs/branch.md)|![0.0.8](https://img.shields.io/badge/version-0.0.8-green.svg)|\n|[componentFromStream](docs/componentFromStream.md)|![1.1.0](https://img.shields.io/badge/version-1.1.0-green.svg)|\n|[compose](docs/compose.md)|![0.0.3](https://img.shields.io/badge/version-0.0.3-green.svg)|\n|[createEventHandler](docs/createEventHandler.md)|![1.1.0](https://img.shields.io/badge/version-1.1.0-green.svg)|\n|[createSink](docs/createSink.md)|![0.0.6](https://img.shields.io/badge/version-0.0.6-green.svg)|\n|[defaultProps](docs/defaultProps.md)|![0.0.3](https://img.shields.io/badge/version-0.0.3-green.svg)|\n|[flattenProps](docs/flattenProps.md)|![0.0.4](https://img.shields.io/badge/version-0.0.4-green.svg)|\n|[mapProps](docs/mapProps.md)|![3.0.1](https://img.shields.io/badge/version-3.0.1-green.svg)|\n|[nest](docs/nest.md)|![0.0.7](https://img.shields.io/badge/version-0.0.7-green.svg)|\n|[pure](docs/pure.md)|![0.0.8](https://img.shields.io/badge/version-0.0.8-green.svg)|\n|[renderComponent](docs/renderComponent.md)|![0.0.8](https://img.shields.io/badge/version-0.0.8-green.svg)|\n|[renderNothing](docs/renderNothing.md)|![0.0.5](https://img.shields.io/badge/version-0.0.5-green.svg)|\n|[renameProp](docs/renameProp.md)|![0.0.4](https://img.shields.io/badge/version-0.0.4-green.svg)|\n|[renameProps](docs/renameProps.md)|![0.0.4](https://img.shields.io/badge/version-0.0.4-green.svg)|\n|[setObservableConfig](docs/setObservableConfig.md)|![1.1.0](https://img.shields.io/badge/version-1.1.0-green.svg)|\n|[shouldUpdate](docs/shouldUpdate.md)|![0.0.3](https://img.shields.io/badge/version-0.0.3-green.svg)|\n|[withHandlers](docs/withHandlers.md)|![0.0.5](https://img.shields.io/badge/version-0.0.5-green.svg)|\n|[withLifecycle](docs/withLifecycle.md)|![0.0.3](https://img.shields.io/badge/version-0.0.3-green.svg)|\n|[withProps](docs/withProps.md)|![0.0.3](https://img.shields.io/badge/version-0.0.3-green.svg)|\n|[withPropsOnChange](docs/withPropsOnChange.md)|![0.0.6](https://img.shields.io/badge/version-0.0.6-green.svg)|\n|[withReducer](docs/withReducer.md)|![0.0.7](https://img.shields.io/badge/version-0.0.7-green.svg)|\n|[withState](docs/withState.md)|![0.0.3](https://img.shields.io/badge/version-0.0.3-green.svg)|\n\n\n## Usage\nPlease find the API and example code in the docs folder.\n\n### Import\nIncompose provides named and default imports:\n```javascript\nimport {withState} from 'incompose';\nimport withState from 'incompose/dist/withState';\n```\n\n### Example\n```javascript\nimport {\n  linkEvent\n} from 'inferno';\n\nimport {\n  compose,\n  withState,\n  shouldUpdate\n} from 'incompose';\n\nconst inc = (props) =\u003e {\n  props.setCount(props.count += 1);\n};\n\nconst dec = (props) =\u003e {\n  props.setCount(props.count -= 1);\n};\n\nconst Counter = (props) =\u003e (\n  \u003cdiv\u003e\n    \u003ch1\u003ecount : {props.count}\u003c/h1\u003e\n    \u003cbutton onClick={linkEvent(props, dec)}\u003e-\u003c/button\u003e\n    \u003cbutton onClick={linkEvent(props, inc)}\u003e+\u003c/button\u003e\n  \u003c/div\u003e\n);\n\n/**\n * with state creates 2 new props on the component props\n * props.count\t\t-\tcontains the value (1 is set as default value)\n * props.setCount\t-\tcontains the setter function\n */\nconst withCounterState = withState('count', 'setCount', 1);\n\n/**\n * should update prevents the component of re-render (shouldUpdate lifecycle hook)\n * you can compare current and next props and decide whether the component\n * should update or not. In this example, the counter just updates if\n * props.count is even.\n */\nconst withUpdatePolicy = shouldUpdate((props, nextProps) =\u003e (\n  nextProps.count % 2 === 0\n));\n\n/**\n * with compose all the extended functions are composed BEFORE Counter\n * gets rendered. Please not that order matters.\n */\nexport default compose(\n  withCounterState,\n  withUpdatePolicy,\n)(Counter);\n```\n\n## Thanks\nSpecial thanks to all the contributors and Andrew Clark ([@acdlite](https://twitter.com/acdlite)) for creating this amazing lib for React!\n\n## Changelog\nChangelog is available [here](CHANGELOG.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzanettin%2Fincompose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzanettin%2Fincompose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzanettin%2Fincompose/lists"}