I'm Kent C. Dodds. I help people make the world better through quality software. Ask me anything!

View original thread
Raghunandan Gupta's photo

Hey KENT!

Hope you are doing good :)

My question: Should a company (mid size) be making it鈥檚 own framework (on top of a library, say React)? Will making abstractions help?

thanks.

Kent C. Dodds's photo

Improving the world with quality software 路 Husband, Father, Latter-day Saint, Teacher, OSS, GDE 路 http://testingjavascript.com @eggheadio

Hi Raghunandan,

Wrapping abstractions is often a good idea because it allows you to swap abstractions for free*. That said, if you try to change to a new abstraction that completely changes the programming model or API, or the hoops you have to jump through to maintain consistency in the API in a way that results in performance problems or something then is it really worth the effort? The wrapping doesn't come for free after all, so you have to know that it's worth the cost.

With something like React, the requirements of that abstraction will be all over your codebase. If you try to wrap that and then later swap the underlying implementation to Angular for example, that will be functionally impossible.

So if you're asking about wrapping React and having people use your own APIs instead of Reacts, then I'd question the value there.

If you're just talking about making a framework on top of React to allow people to build apps at your company faster, then that's a different thing entirely. Something like Next.js or Gatsby fall into this category. They don't hide React, they just add some opinions. I did this at PayPal, and I recommend it. If you have more than four or five unique applications that you're building at your company, then building a toolkit or framework can save you a lot of time. Though a toolkit as I mention in those posts isn't quite the same as a Next.js or Gatsby. You should be able to build a toolkit on top of those and you'll benefit from those larger communities.

I hope that helps. Good luck!