<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: ksencherey</title>
    <description>The latest articles on Forem by ksencherey (@ksencherey).</description>
    <link>https://forem.com/ksencherey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F964246%2F7f3b5137-aa55-4532-ae52-74bc13153696.png</url>
      <title>Forem: ksencherey</title>
      <link>https://forem.com/ksencherey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ksencherey"/>
    <language>en</language>
    <item>
      <title>Help needed to write javascript in react app</title>
      <dc:creator>ksencherey</dc:creator>
      <pubDate>Thu, 03 Nov 2022 15:02:32 +0000</pubDate>
      <link>https://forem.com/ksencherey/help-needed-to-write-javascript-in-react-js-57fh</link>
      <guid>https://forem.com/ksencherey/help-needed-to-write-javascript-in-react-js-57fh</guid>
      <description>&lt;p&gt;Hi Team, I have this javascript code which is used in my html file to rotate a carousel.&lt;br&gt;
Javacsript.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var angle = 0;
function galleryspin(sign) {
  spinner = document.querySelector("#spinner");
  if (!sign) {
    angle = angle + 45;
  } else {
    angle = angle - 45;
  }
  spinner.setAttribute(
    "style",
    "-webkit-transform: rotateY(" +
      angle +
      "deg); -moz-transform: rotateY(" +
      angle +
      "deg); transform: rotateY(" +
      angle +
      "deg);"
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The html line which calls this function looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt; 
        &amp;lt;p class="Carousel-header"&amp;gt;Text
        &amp;lt;/p&amp;gt;   
      &amp;lt;base href="1.jpg" /&amp;gt;  
        &amp;lt;div id="carousel3D"&amp;gt;
          &amp;lt;figure id="spinner"&amp;gt;
            &amp;lt;img src="images/1.jpg" alt /&amp;gt;
            &amp;lt;img src="images/2.jpg" alt /&amp;gt;
            &amp;lt;img src="images/3.jpg" alt /&amp;gt;
            &amp;lt;img src="images/4.jpg" alt /&amp;gt;
            &amp;lt;img src="images/5.jpg" alt /&amp;gt;
            &amp;lt;img src="images/6.jpg" alt /&amp;gt;
            &amp;lt;img src="images/7.jpg" alt /&amp;gt;
            &amp;lt;img src="images/8.jpg" alt /&amp;gt;
            &amp;lt;img src="images/9.jpg" alt /&amp;gt;

          &amp;lt;/figure&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div class="carousel-nav"&amp;gt;
&amp;lt;span  class="ss-icon  left" onclick="galleryspin('-')"
              &amp;gt;&amp;amp;lt;&amp;lt;/span
            &amp;gt;
            &amp;lt;span class="ss-icon  right"onclick="galleryspin('')"
              &amp;gt;&amp;amp;gt;&amp;lt;/span
            &amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;I want to implement this in react js. I have created the rfce for the &lt;/p&gt; but the code is not working when I click on the &amp;lt; and &amp;gt; buttons to rotate. Looks like the onclick is not calling the galleryspin function. How do I get this to work in react app?

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>react</category>
    </item>
  </channel>
</rss>
