jscissr / react-polymer

Use Polymer elements in React

Home Page:https://jscissr.github.io/react-polymer/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do we still need it with react 16?

MOZGIII opened this issue · comments

React 16 added proper support for custom props, so do we still have issues with polymer components?

Yes, custom props is only one problem solved by react-polymer. The others are:

  • custom events
  • using className instead of class, like with other React DOM elements
  • <PolymerElem foo={false} /> should mean omit the foo attribute, instead of setting it to the string 'false'

However, since React 16 is bundled into one file, it looks like it is no longer possible to do the monkey patching that react-polymer does to make these things work. Maybe the only way to make it work is with a custom build of React. But this would mean a lot more maintenance effort, because I would have to release a new react-polymer version for every React release, instead of just major React releases.

I see. Maybe support for it can be just added to react itself then?
I may be not understanding the situation completely, but className is not that important (is there something that relies heavily on className and would work with shadow-dom-based components? otherwise it's just for consistency, may not be worth the efforts). Ommitting the attribue when props is set to false would also be useful, but it can be dealt with.
Custom events are problematic though, I think you have to make a react wrapper for every polymer component that uses events to bind to them from react, right? Maybe we could just implemnt HOC for it, or sth?