<?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: Nazmul Hasan👻</title>
    <description>The latest articles on DEV Community by Nazmul Hasan👻 (@hasan101002).</description>
    <link>https://dev.to/hasan101002</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%2F170402%2Fc4c4656d-5e09-44b7-bb5c-58052d26ffc2.jpg</url>
      <title>DEV Community: Nazmul Hasan👻</title>
      <link>https://dev.to/hasan101002</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hasan101002"/>
    <language>en</language>
    <item>
      <title>How to change navigation bar colour using Native Stack Navigator</title>
      <dc:creator>Nazmul Hasan👻</dc:creator>
      <pubDate>Wed, 22 May 2024 11:18:52 +0000</pubDate>
      <link>https://dev.to/hasan101002/how-to-change-navigation-bar-colour-using-native-stack-navigator-40ha</link>
      <guid>https://dev.to/hasan101002/how-to-change-navigation-bar-colour-using-native-stack-navigator-40ha</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/T9vumZF7F98"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>react</category>
      <category>mobile</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Why Axios is reducing api response?</title>
      <dc:creator>Nazmul Hasan👻</dc:creator>
      <pubDate>Wed, 02 Sep 2020 05:19:29 +0000</pubDate>
      <link>https://dev.to/hasan101002/why-axios-is-reducing-api-response-4b7p</link>
      <guid>https://dev.to/hasan101002/why-axios-is-reducing-api-response-4b7p</guid>
      <description>&lt;p&gt;Is there any specific reason , why axios might reduce api response? such as the response is an array and there is 2 index data , but after axios process data only one remains. And if there is 1 index , it becomes an empty array. #axios #ReactNative&lt;br&gt;
My code is given below , &lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
let response = await axios.get(
      `$url`,
      {
        headers: {Authorization: authorize(token)},
      },
    );
    console.log(response);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>reactnative</category>
      <category>javascript</category>
      <category>help</category>
    </item>
    <item>
      <title>Nested object clone disaster!!!!!</title>
      <dc:creator>Nazmul Hasan👻</dc:creator>
      <pubDate>Tue, 06 Aug 2019 05:29:48 +0000</pubDate>
      <link>https://dev.to/hasan101002/nested-object-clone-disaster-4efo</link>
      <guid>https://dev.to/hasan101002/nested-object-clone-disaster-4efo</guid>
      <description>&lt;p&gt;I was just trying to clone a parameter and after some manipulation update the redux state. But some unwanted value is updating , cause the clone copied the reference of the object also. Normally we try to assign a value of an object to another via ,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sourceObject&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But, it can mutate the source object sometime, if the object is nested. Another way of doing the clone is,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;sourceObject&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Still same result. Also tried,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;({},&lt;/span&gt;&lt;span class="nx"&gt;sourceObject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No change of the scenario. Then, lodash came to rescue,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cloneDeep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sourceObject&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, it's just cloning the object without mutating it.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>reactnative</category>
      <category>redux</category>
    </item>
    <item>
      <title>ComponentDidUpdate is not firing !!!!!</title>
      <dc:creator>Nazmul Hasan👻</dc:creator>
      <pubDate>Fri, 02 Aug 2019 05:22:01 +0000</pubDate>
      <link>https://dev.to/hasan101002/componentdidupdate-is-not-firing-350k</link>
      <guid>https://dev.to/hasan101002/componentdidupdate-is-not-firing-350k</guid>
      <description>&lt;p&gt;I was updating a certain redux state in reducer like this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nx"&gt;UPDATE_SOMETHING&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;something&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and i was checking the state update like following,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;componentDidUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevProps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;prevState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevProps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;something&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the problem is, i can see that my redux state is update in redux debugger, but componentDidUpdate is not firing anymore !!!!. After wondering for a while , i tried to update the redux state using shallow copy. Like this,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nx"&gt;UPDATE_SOMETHING&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;something&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;something&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Its, working now!!!!!!&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>redux</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Flatlist is not re rendering on props update</title>
      <dc:creator>Nazmul Hasan👻</dc:creator>
      <pubDate>Tue, 16 Jul 2019 06:38:45 +0000</pubDate>
      <link>https://dev.to/hasan101002/flatlist-is-not-re-rendering-on-props-update-35oc</link>
      <guid>https://dev.to/hasan101002/flatlist-is-not-re-rendering-on-props-update-35oc</guid>
      <description>&lt;p&gt;I was trying to update an icon in flatlist according props. But its seems though the props is updated, no changes is reflected in view. I consoled data in every flow that is going on , to check what's missing. Roaming around the console for a while resorted to stackOverflow and found the solution &lt;a href="https://stackoverflow.com/a/51416714/3237884"&gt;https://stackoverflow.com/a/51416714/3237884&lt;/a&gt; . &lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>redux</category>
    </item>
  </channel>
</rss>
