DEV Community

Cover image for The main reason why I don't use Redux in my projects
Nitsan Cohen
Nitsan Cohen

Posted on • Edited on

The main reason why I don't use Redux in my projects

The main reason why I don't use Redux in my projects

There are several reasons why not to use Redux.

And choose another more modern library like Recoil (see my comparison here).

But the main reason why I don't use Redux has nothing to do with Redux itself. For the same following explanation, I won't use Recoil as well.

I don't use Redux because I want my components to be decoupled from a third-party library.

What do I mean?

When I create a component with Bit, I know these components will be used in dozens or even hundreds of applications.

A component in Bit is independent - it is versioned and built independently and installed in your project like any other package using npm (for instance - npm i @teambit/base-ui.input.button also don't forget to configure your npm registry npm config set '@teambit:registry' https://node.bit.dev

I don't know what libraries the consumers of my components will want to use. Maybe they will want to use Recoil? Perhaps Redux? Or even the beloved Context!

That is why I have to abstract my components from any third-party library. That way, I enable everyone to use it with ease.

If I have to pass something from a distant parent, I use Context. Context is part of the React library, so I have no problem using it!

I am sure my consumers will be using React since I am creating a React component.

I will show you how I create agnostic components in the next post. Meanwhile, try making your components and exporting them.

In the attached code block, you will find instructions on quickly starting your own lab to create and export independent components.

Image description


  • For more posts like this follow me on LinkedIn

  • I work as frontend & content developer for Bit - a toolchain for component-driven development (Forget monolithic apps and distribute to component-driven software).

Top comments (1)

Collapse
 
projektorius96 profile image
LG

I don't feel comprehensive in React tho, but one I've learnt in Svelte which I assume maintains similar idea : Props are simplest & most complicated at once . To make it less complicated we use Context, but Context & Props works well only in the same Node tree, if you need to conjoin two independent Node-trees – use Redux, although in Svelte we would use Store . In the conclusion : use Redux/Store only in advanced apps, otherwise don't be a hipster if don't get paid !