Problem: When using a third party component library, it's common to set the...


Problem: When using a third party component library, it's common to set the same props each time you use a component.

Solution: Wrap it.

Benefits:
✅ Enforces consistency
✅ Simplifies each call site
✅ Provides a single place to change if we tweak our usage later.

#react

After I've wrapped it, I use ESLint's no-restricted-imports to disallow using the component directly.

This is a nice way to remind the team "just in time" that we've wrapped the component.

The message is customizable so I say: "Use our Button instead".

https://eslint.org/docs/latest/rules/no-restricted-imports

View original on X