DEV Community

Discussion on: Passing Data Between React Components

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

React utilizes reusable components. This allows you to reuse your code,

But it doesn't allow others to reuse your code unless they buy into the react silo

This is why if you're publishing components, you should not publish them as react components, but custom elements instead.

Every framework except react (including preact) supports custom elements, and if you are stuck with react, you can use a wrapper to add support.

You might think it looks good on a resume now, but in a few years you'll be stuck with framework skills instead of web skills.

If you like the react API, use preact, but if you're writing reusable components, publish web components.