# recompose **Repository Path**: mirrors_fis-components/recompose ## Basic Information - **Project Name**: recompose - **Description**: Fork from https://github.com/acdlite/recompose.git - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2025-12-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Recompose ----- [![build status](https://img.shields.io/travis/acdlite/recompose/master.svg?style=flat-square)](https://travis-ci.org/acdlite/recompose) [![coverage](https://img.shields.io/codecov/c/github/acdlite/recompose.svg?style=flat-square)](https://codecov.io/github/acdlite/recompose) [![code climate](https://img.shields.io/codeclimate/github/acdlite/recompose.svg?style=flat-square)](https://codeclimate.com/github/acdlite/recompose) [![npm version](https://img.shields.io/npm/v/recompose.svg?style=flat-square)](https://www.npmjs.com/package/recompose) [![npm downloads](https://img.shields.io/npm/dm/recompose.svg?style=flat-square)](https://www.npmjs.com/package/recompose) [![recompose channel on discord](https://img.shields.io/badge/discord-%23recompose%20%40%20reactiflux-61dafb.svg?style=flat-square)](https://discord.gg/0ZcbPKXt5bWAj4rn) Recompose is a React utility belt for function components and higher-order components. Think of it like lodash for React. ``` npm install recompose --save ``` ### Related modules - [**recompose-relay**](https://github.com/acdlite/recompose/tree/master/src/packages/recompose-relay) — Recompose helpers for Relay - [**rx-recompose**](https://github.com/acdlite/recompose/tree/master/src/packages/rx-recompose) — RxJS utilities for Recompose and React ## You can use Recompose to... ### ...lift state into functional wrappers Helpers like `withState()` and `withReducer()` provide a nicer way to express state updates: ```js const Counter = withState( 'counter', 'setCounter', 0, ({ counter, setCounter }) => (
Count: {counter}
) ) ``` Or with a Redux-style reducer: ```js const counterReducer = (count, action) => { switch (action.type) { case INCREMENT: return count + 1 case DECREMENT: return count - 1 default: return count } } const Counter = withReducer( 'counter', 'dispatch', counterReducer, 0, ({ counter, dispatch }) => (
Count: {counter}
) ) ``` ### ...perform the most common React patterns Helpers like `componentFromProp()` and `withContext()` encapsulate common React patterns into a simple functional interface: ```js const Button = defaultProps( { component: 'button' }, componentFromProp('component') )