Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one use a polymer component inside a react component ? Is it possible?

I have used google's polymer to make web components but i am also very interested in giving react a try. So i want to know whether it is possible to use the polymer component from inside the render function of a react component ?

like image 764
Sidhartha Satapathy Avatar asked Nov 10 '22 12:11

Sidhartha Satapathy


1 Answers

Yes it is possible ! I did it using a method thats kinda bit complicated but i would love to share it.

if you have already used polymer then just directly use the polymer the way you use it any other polymer element. all you have to do is convert this react folder to a js. You can follow this tutorial in order to convert a jsx to js. and use any polymer element without a problem.

https://www.youtube.com/watch?v=4WUATF3hGUQ

This is not my tutorial but something i saw on youtube . all credits for this tutorial go to codingwithjesse

As asked by WiredPraire , i would like to show you with an example

this is my index.html : enter image description here

This is poly-react.html the polymer element: enter image description here

This is my polyreact.jsx which also has polymer element inside

enter image description here

and the polymer inside above jsx started working with this transformation which can be done using the tutorial:

enter image description here

The index file also has to be changed like this:

enter image description here

hope this helps!!!!!!!!

like image 141
Sidhartha Satapathy Avatar answered Nov 16 '22 01:11

Sidhartha Satapathy