<?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: F. Selçuk Can</title>
    <description>The latest articles on DEV Community by F. Selçuk Can (@fselcukcan).</description>
    <link>https://dev.to/fselcukcan</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%2F193787%2F9eab1b94-57b2-4616-abb3-a1db386b7b09.png</url>
      <title>DEV Community: F. Selçuk Can</title>
      <link>https://dev.to/fselcukcan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fselcukcan"/>
    <language>en</language>
    <item>
      <title>What should I do if an operation depends on another first variable</title>
      <dc:creator>F. Selçuk Can</dc:creator>
      <pubDate>Thu, 11 Jul 2019 14:04:40 +0000</pubDate>
      <link>https://dev.to/fselcukcan/what-should-i-do-if-an-operation-depends-on-another-first-variable-3ho8</link>
      <guid>https://dev.to/fselcukcan/what-should-i-do-if-an-operation-depends-on-another-first-variable-3ho8</guid>
      <description>&lt;p&gt;What should I do if an operation depends on another first variable that is set by a setVariable (in the react hooks regard) in a &lt;code&gt;useEffect&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This operation may set another second variable with the first variable.&lt;/p&gt;

&lt;p&gt;I currently use another effect and check if the first variable is not &lt;code&gt;undefined&lt;/code&gt; like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(() =&amp;gt; {
    if (firstVariable) {
        let secondVariable = f(firstVariable)
    }
}, [firstVariable])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Is it a bad pattern?&lt;br&gt;
Is there a better way doing this?&lt;/p&gt;

&lt;p&gt;Note: &lt;code&gt;f&lt;/code&gt; is a hypothetical function defined somewhere else. It is jsut to show I am just not renaming the &lt;code&gt;firstVariable&lt;/code&gt; but making arbitrary operations on it. What is the operations are out of purpose of this topic.&lt;/p&gt;

</description>
      <category>react</category>
      <category>reacthooks</category>
    </item>
  </channel>
</rss>
