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.