I have been using React and look to use Polymer tags inside of React. React does not recognize Polymer tags as React only handles basic DOM tags. Is there a way to add the Polymer tags to React DOM library?
Polymer is an open-source JavaScript library for building web applications using Web Components.
Why Use Polymer. js? It allows to create our own custom elements easily using the HTML, CSS, and JavaScript for adding interactions to the element. It is created by Google that provides cross-browser compatible applications along with the web components.
At its very core, React basically maintains a tree for you. This tree is able to do efficient diff computations on the nodes. Think of your HTML code as a tree. In fact, that is exactly how the browser treats your DOM (your rendered HTML on the browser).
React components has a built-in state object. The state object is where you store property values that belongs to the component. When the state object changes, the component re-renders.
Yes, it is possible.
Create a polymer element.
<link rel="import" href="../../bower_components/polymer/polymer.html">
Polymer({ is: 'calender-element', ready: function(){ this.textContent = "I am a calender"; } });
Make the polymer component a html tag by importing it in a html page. E.g. import it in the index.html of your react application.
<link rel="import" href="./src/polymer-components/calender-element.html">
Use that element in the jsx file.
'use strict'; import React from 'react'; class MyComponent extends React.Component{ render(){ return ( <calender-element></calender-element> ); } } export default MyComponent;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With