Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-polymer-component
Advanced tools
Changelog
[0.1.4]-2019-06-03
Readme
This project represents an experiment to simplify the use of Polymer Elements with React Components but is not intended to for use in a production environment and no longer maintained.
A generic React.Component
for wrapping Polymer Elements and binding events and property data between them. No changes to the element required!
Polymer elements can be wrapped and used in two ways and used just like any other React component in the render()
function:
const React = require('react')
// Generic class for wrapping a Polymer element
const PolymerComponent = require('react-polymer-component')
// Get a class that specifically wraps the element 'my-polymer-element'
const MyPolymerElement = PolymerComponent.bind('my-polymer-element')
class SubComponent extends React.Component {
// ...
render() {
return <div>
// ...
<PolymerComponent element-tag="my-polymer-element"></PolymerElement>
// or
<MyPolymerElement></MyPolymerElement>
// ...
</div>
}
}
Data is bound like all other React properties and set on the Polymer element using the set()
function. The property must exist in the Polymer class' properties
object to be bound. If a bound property is removed or set to undefined
, then the original Polymer property value is used.
<MyPolymerElement items={ this.props.items }></MyPolymerElement>
Events are registered using the existing Polymer convention of prefixing events with on-
, so they can easily be bound to from a React component.
<MyPolymerElement on-my-custom-event={ e => console.log('Event Fired!', e) }></MyPolymerElement>
Slot elements and slotted children work as expected, including using the slot
attribute field.
<MyPolymerElement>
<div slot="special-slot">Slotted Content!</div>
</MyPolymerElement>
The styles passed to the element are applied to the Polymer element directly. CSS variables work to the extent that they work in modern browsers.
<MyPolymerElement style={ { '--color-variable': 'red' } }></MyPolymerElement>
FAQs
A generic React.Component for wrapping Polymer Elements and binding events and property data between them
The npm package react-polymer-component receives a total of 1 weekly downloads. As such, react-polymer-component popularity was classified as not popular.
We found that react-polymer-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.