0

I have to work on React JS application which is currently developed using compose function of Recompose. [https://github.com/acdlite/recompose][1]

As per plan to rewrite the Application from Scratch, What is best choice Recompose or Redux?

Recompose creator discontinue active maintenance of this package.What should i do? Keep continue using Recompose or move to Redux?

Muhammad Awais
  • 463
  • 1
  • 6
  • 17

1 Answers1

1

As @estus said, Redux and recompose are not equivalent.

As you maybe know, Redux is only for keeping the state of the app, thats means when you consume a service and get a response, modify the value of some UI component, etc, an action is dispatched and through the reducer it updates the state of the app in the store. Then, the UI component which is subscribed to the store is re-rendered.

On the other hand, Recompose allows you to enhance functional components.

For example, add custom props, add lifecycle and also state and handlers to functional components.

Additionally, the recompose philosopy is to keep the components as thin as possible and split it to separate the responsabilities, then compose it with enhancers.

It makes sense because you can reuse repetitive logic in different components.

Here an example without using Recompose

Here the same using Recompose

As a conclusion, I'd say that you can use Redux for keeping the state and Recompose to keep it simple, separating the responsabilities, having functional components enhanced by little enhancers which encapsulate specific logic.

In future version of React, I think most utilities of Recompose could be added to the library.

Leo
  • 712
  • 8
  • 10
  • Perhaps it should be noted that recompose has been declared deprecated by the author: "Today, we announced a proposal for Hooks. Hooks solves all the problems I attempted to address with Recompose three years ago, and more on top of that. I will be discontinuing active maintenance of this package (excluding perhaps bugfixes or patches for compatibility with future React releases), and recommending that people use Hooks instead." – Patrick Hund Jan 15 '19 at 19:29
  • Probably you are right, but Hooks dont solve all the things Recompose do, it's still up to you if you decide using recompose for new projects. – Leo Jan 15 '19 at 20:11
  • Not necessarily my opinion, it’s the opinion of Andrew Clark, Developer at Facebook, core contributor to React and author or Recompose. I really like recompose btw. – Patrick Hund Jan 16 '19 at 06:45