InterviewHubPRO
Section Overview
Q145

Question 145 of 445

Part 7: Supported Libraries, Styling & Integrations (139 - 151)

33%
React & Modern Frontend (445 Qs)•Part 7: Supported Libraries, Styling & Integrations (139 - 151)

How to use Polymer in React?

You need to follow below steps to use Polymer in React,

  1. Create a Polymer element:
jsx
 <link
   rel="import"
   href="../../bower_components/polymer/polymer.html"
 />;
 Polymer({
   is: "calendar-element",
   ready: function () {
     this.textContent = "I am a calendar";
   },
 });
  1. Create the Polymer component HTML tag by importing it in a HTML document, e.g. import it in the index.html of your React application:
html
 <link
   rel="import"
   href="./src/polymer-components/calendar-element.html"
 />
  1. Use that element in the JSX file:
javascript
 export default function MyComponent {
   return <calendar-element />;
 }