react-recompose is a community-maintained fork of the original `recompose` library, designed to bring its utility belt for functional React components and higher-order components (HOCs) into compatibility with modern React versions. While the original `recompose` was officially deprecated by its author in 2018, advocating for React Hooks as its successor, this fork ensures its functionalities work with React 17 and 18. The current stable version is 0.33.0. Releases are primarily focused on dependency updates, security patches, and maintaining compatibility with the evolving React ecosystem, rather than introducing new features. It provides an HOC-based composition pattern for projects that predate Hooks or prefer this architectural style for component logic reuse.
npm install react-recomposeVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `withState` and `compose` from `react-recompose` to manage local component state via a Higher-Order Component pattern.
Consider migrating new component logic to React Hooks (e.g., `useState`, `useEffect`, `useReducer`) for better long-term maintainability and alignment with current React best practices.
Install using `yarn add recompose@npm:react-recompose` (or `npm install recompose@npm:react-recompose`) and ensure your import statements use `from 'recompose'`. If not aliased, you must import from 'react-recompose'.
Ensure your project uses React 16.2.0 or higher. For React 18 compatibility, use `react-recompose` v0.33.0 or later.
Be aware that performance optimizations related to `shouldComponentUpdate` or pure components are not implicitly applied by all recompose helpers. Profile your application and implement `React.memo` or `useMemo`/`useCallback` where necessary with modern React.
Ensure that components enhanced by recompose HOCs do not directly call Hooks at their top level unless they are themselves functional components that follow Hook rules. Prefer using either a pure HOC or pure Hook approach for a given component's logic.
Verify that `react-recompose` is installed as `recompose` via `yarn add recompose@npm:react-recompose` (or `npm install recompose@npm:react-recompose`), and that your import statements are `import { ... } from 'recompose';`.Either install the package with the alias (`yarn add recompose@npm:react-recompose`) or change your import statements to `import { ... } from 'react-recompose';`.Check the `peerDependencies` of `react-recompose` and ensure your project's `react` and `react-dom` versions fall within the specified range. Update React if necessary.