In React, we think of everything as components. If we want to add a new feature, we make a new component and add it to our app. Every time we have to enable/disable a feature, we have to add/remove that component from the entire app and this becomes cumbersome when working on a complex app where there are lots of features contributed by different developers.
We are a huge fan of Laravel and love how Service Provider works in it. Motivated by how we register any service for the entire app from one place, we built a plugin system that has all your features and can be enabled/disabled with a single line of code.
React Pluggable simplifies the problem in 3 simple steps:
- To add a new feature in your app, you write it's logic and install it in the plugin store.
- You can use that feature anywhere in the app by calling that feature using PluginStore rather than importing that feature directly.
- If you do not want a particular plugin in your app, you can uninstall it from your plugin store or just comment out the installation.