<?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>DEV Community: Wayne</title>
    <description>The latest articles on DEV Community by Wayne (@waynemacmavis).</description>
    <link>https://dev.to/waynemacmavis</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%2F528610%2F42248bd7-aede-4a7d-92d5-2ef1dd770b58.jpeg</url>
      <title>DEV Community: Wayne</title>
      <link>https://dev.to/waynemacmavis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/waynemacmavis"/>
    <language>en</language>
    <item>
      <title>Modify existing code to what Im more familiar with</title>
      <dc:creator>Wayne</dc:creator>
      <pubDate>Mon, 22 Feb 2021 14:03:42 +0000</pubDate>
      <link>https://dev.to/waynemacmavis/modify-existing-code-to-what-im-more-familiar-with-32li</link>
      <guid>https://dev.to/waynemacmavis/modify-existing-code-to-what-im-more-familiar-with-32li</guid>
      <description>&lt;p&gt;Hi all, I do not know if this is an acceptable question for this foram. But i haven't been lucky on Stack overflow. &lt;/p&gt;

&lt;p&gt;My question is related to modifying some code I found online. I'm new to React. And Im trying to learn as i go. Currently Im stuck on making a blur on scroll component. But I have become familiar with a curtain way the structure should look. I will post the code I found first followed by what I am used to seeing. Any feedback is welcome. I ideally would like to modify this code into the way I understand But alternatively if somebody could show me how to implement this code as is that would also be amazing.&lt;/p&gt;

&lt;p&gt;The code I found... Written entirely in the index.js file. And  it has many functions. Please see link below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/s/crazy-turing-jivgb?file=/src/index.js:0-3520"&gt;https://codesandbox.io/s/crazy-turing-jivgb?file=/src/index.js:0-3520&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Structure I am familiar, Which is all inside of its own file linked to the App.js file. And the code is written inside of class Home extends Component. And towards the end the file gets called. And there is no state in the first code where there is in the second code. And the way it was explained is that state is to change values. So that all confuses me. &lt;/p&gt;

&lt;p&gt;import React, { Component } from 'react';&lt;br&gt;
import './Home.css';&lt;br&gt;
import video from './home-bg.mp4';&lt;br&gt;
import Parallax from '../Parallax';&lt;/p&gt;

&lt;p&gt;class Home extends Component {&lt;br&gt;
  constructor(props) {&lt;br&gt;
    super(props);&lt;br&gt;
    this.state = {&lt;br&gt;
      text:"This is sample text",&lt;br&gt;
      text2:"This is sample text for text2",&lt;br&gt;
      count:0,&lt;br&gt;
      show:"",&lt;br&gt;
      show2:"",&lt;br&gt;
    }&lt;br&gt;
    this.update = this.update.bind(this);&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;componentDidMount() {&lt;br&gt;
    this.timerID = setInterval(&lt;br&gt;
      () =&amp;gt; this.update(),&lt;br&gt;
      100&lt;br&gt;
    );&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;componentWillUnmount() {&lt;br&gt;
    clearInterval(this.timerID);&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;update(){&lt;br&gt;
    const counter = this.state.count;&lt;br&gt;
    const text = this.state.text;&lt;br&gt;
    const text2 = this.state.text2;&lt;br&gt;
    const letter = text.charAt(counter);&lt;br&gt;
    // Note: It'll be empty string for negative index&lt;br&gt;
    const letter2 = text2.charAt(counter - text.length);&lt;br&gt;
    const textlength = text.length + text2.length;&lt;br&gt;
    //let text += letter;&lt;br&gt;
    console.log("counter : " + counter + " / letter : " + letter);&lt;br&gt;
    console.log("counter : " + counter + " / letter2 : " + letter2);&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(counter &amp;lt;= textlength){
this.setState({
  show: this.state.show + letter,
  show2: this.state.show2 + letter2,
  count: this.state.count + 1,
});
}else{
  clearInterval(this.timerID);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;render() {&lt;br&gt;
    return (&lt;br&gt;
      &lt;/p&gt;
&lt;br&gt;
        &lt;br&gt;
          &lt;br&gt;
        &lt;br&gt;
          &lt;br&gt;
                &lt;br&gt;
{/* &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NuCFY5eK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/media/profile.jpg"&gt; */}&lt;br&gt;
&lt;br&gt;
                &lt;br&gt;
              &lt;h1&gt;{this.state.show}&lt;/h1&gt;
&lt;br&gt;
              
&lt;br&gt;
              &lt;h2&gt;{this.state.show2}&lt;/h2&gt;
&lt;br&gt;
            &lt;br&gt;
            &lt;br&gt;
          &lt;br&gt;
        &lt;br&gt;
      &lt;br&gt;
    );&lt;br&gt;
  }&lt;br&gt;
}

&lt;p&gt;export default Home;&lt;/p&gt;

&lt;p&gt;I hope that i explained what i need clearly enough. But please let me know if you need more info.&lt;/p&gt;

&lt;p&gt;If any body could assist in helping me with this it would be greatly appreciated. &lt;/p&gt;

</description>
      <category>react</category>
      <category>help</category>
      <category>motivation</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
