<?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: Kelliann Lafferty</title>
    <description>The latest articles on Forem by Kelliann Lafferty (@klaffert).</description>
    <link>https://forem.com/klaffert</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%2F297498%2F8a446857-c0e6-422b-a144-349c2e23b053.jpg</url>
      <title>Forem: Kelliann Lafferty</title>
      <link>https://forem.com/klaffert</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/klaffert"/>
    <language>en</language>
    <item>
      <title>Differences between client-side storage solutions</title>
      <dc:creator>Kelliann Lafferty</dc:creator>
      <pubDate>Tue, 02 Jun 2020 19:30:46 +0000</pubDate>
      <link>https://forem.com/klaffert/differences-between-client-side-storage-solutions-2oio</link>
      <guid>https://forem.com/klaffert/differences-between-client-side-storage-solutions-2oio</guid>
      <description>&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What are cookies, local storage and session storage and what are some differences?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All three of these are client-side storage solutions (i.e. a cookie is both client and server-side) that can be used to store data that is needed within client scripts between pages. &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Differences&lt;/th&gt;
&lt;th&gt;Uses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cookies&lt;/td&gt;
&lt;td&gt;Small piece of data that a server sends to the user's browser that is then stored and sent back with future requests to the same server&lt;/td&gt;
&lt;td&gt;4KB Storage - Server and client side reading - Supported by older browsers - Expiration varies&lt;/td&gt;
&lt;td&gt;Logins, shopping carts, game scores, user preferences, tracking user behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LocalStorage&lt;/td&gt;
&lt;td&gt;Window property (window.localStorage) that is saved across browser sessions. The data stored is not sent back to the server with each HTTP request, reducing traffic between client and server&lt;/td&gt;
&lt;td&gt;5MB/10MB storage - Not as supported by older browsers - Never expires or removed, unless explicitly done so&lt;/td&gt;
&lt;td&gt;Login forms remembering username, user preferences, custom settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SessionStorage&lt;/td&gt;
&lt;td&gt;Similar to LocalStorage, however, data does not persist across browsers. Data is only available during the page session.&lt;/td&gt;
&lt;td&gt;5MB - Data will be deleted after session (browser) closed - Not as supported by older browsers&lt;/td&gt;
&lt;td&gt;Use in cases where you do not want the data to persist over time&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#:%7E:text=An%20HTTP%20cookie%20(web%20cookie,logged%2Din%2C%20for%20example"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#:~:text=An%20HTTP%20cookie%20(web%20cookie,logged%2Din%2C%20for%20example&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/jsref/prop_win_sessionstorage.asp"&gt;https://www.w3schools.com/jsref/prop_win_sessionstorage.asp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/19867599/what-is-the-difference-between-localstorage-sessionstorage-session-and-cookies"&gt;https://stackoverflow.com/questions/19867599/what-is-the-difference-between-localstorage-sessionstorage-session-and-cookies&lt;/a&gt;&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Comparing variables in Javascript</title>
      <dc:creator>Kelliann Lafferty</dc:creator>
      <pubDate>Thu, 14 May 2020 21:52:04 +0000</pubDate>
      <link>https://forem.com/klaffert/comparing-variables-in-javascript-5b02</link>
      <guid>https://forem.com/klaffert/comparing-variables-in-javascript-5b02</guid>
      <description>&lt;p&gt;As I go through the job search process, I like to keep track of questions that I've been asked that I don't exactly know the answer to but feel like I should. To alleviate these feelings, I'm making an effort to keep track of these questions and then write short posts on them to hopefully:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Solidify these concepts for myself, so I'll be more prepared in the next interview&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Help another developer understand these concepts so they may be more prepared if they are asked these questions in the future&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Question
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;What is the difference between '==' and '==='?&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;These are known as comparison operators and Javascript has both  &lt;strong&gt;type-converting&lt;/strong&gt; and &lt;strong&gt;strict&lt;/strong&gt; comparisons. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Type-converting&lt;/strong&gt; comparisons (e.g. ==) will first convert the elements to the same type (if they aren't already) and then make the comparison.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;object1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;object2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;object1&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;object2&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="c1"&gt;// true &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strict&lt;/strong&gt; comparisons (e.g. ===) will only return true if the elements on both sides are of the same type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;object1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;object2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;object1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;object2&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="c1"&gt;// false &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Follow-up Question
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;What would be the output of "null == undefined" and "null === undefined" in Javascript and why?&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Answer
&lt;/h3&gt;

&lt;p&gt;As you can see from the code above, based on the comparison operator, one of these is true, whereas the other one is false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// object&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Null == Undefined, with a type-converting equality operator, returns true because Null and Undefined are two different data types in Javascript. Null is considered an object, and Undefined is considered a type of undefined. Since these are two separate data types, the '==' converts null and undefined to the same type and then compares them and since they both represent an empty value, they are considered equal in the abstract sense. &lt;/p&gt;

&lt;p&gt;As for Null === Undefined, this is a false statement, because they are inherently not the the same data type (object vs. undefined) and thus, this is strictly false. &lt;/p&gt;

&lt;p&gt;Happy coding! :)&lt;/p&gt;

&lt;p&gt;More resources:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en/US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators"&gt;https://developer.mozilla.org/en/US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://levelup.gitconnected.com/javascript-null-vs-undefined-2acda986f79f"&gt;https://levelup.gitconnected.com/javascript-null-vs-undefined-2acda986f79f&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>todayilearned</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to add headers to DrawerNavigator screens in React Native</title>
      <dc:creator>Kelliann Lafferty</dc:creator>
      <pubDate>Wed, 04 Mar 2020 05:34:23 +0000</pubDate>
      <link>https://forem.com/klaffert/how-to-add-headers-to-drawernavigator-screens-in-react-native-4hkl</link>
      <guid>https://forem.com/klaffert/how-to-add-headers-to-drawernavigator-screens-in-react-native-4hkl</guid>
      <description>&lt;p&gt;While working on a current project, I came across the issue on how exactly to add headers to screens within my DrawerNavigator (createDrawerNavigator). Here is a visual of what I was trying to accomplish: &lt;/p&gt;

&lt;p&gt;Menu screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ovt8XaiP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yk8kzcugost4nismhi2y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ovt8XaiP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yk8kzcugost4nismhi2y.png" alt="drawer-navigator-screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Without Header screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gYbMteCT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wth8ruoiui42aj1ml4os.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gYbMteCT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wth8ruoiui42aj1ml4os.png" alt="without-header"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Header screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yeJNm9Tf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uiqm22671t2a2jfifm4a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yeJNm9Tf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uiqm22671t2a2jfifm4a.png" alt="with-header"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see from the above images, I wanted the screens within the DrawerNavigator to have header titles that matched the component name. So, in this example, I wanted the 'Notifications' screen to have the header actually show 'Notifications' (or whatever the screen title was). &lt;/p&gt;

&lt;p&gt;After digging around the React Native docs and some forums, I found two resources that actually helped me solve this issue (sources at bottom). It appeared that I needed to make each screen within the DrawerNavigator have its own StackNavigator and then set the navigationOptions to the component screen. I'll outline my example code below for you to see this in action:&lt;/p&gt;

&lt;p&gt;We will want to start with creating the DrawerNavigator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createDrawerNavigator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-navigation-drawer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createStackNavigator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-navigation-stack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Notifications&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../menu/Notifications&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// this is the Notifications screen component&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MenuNavigator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createDrawerNavigator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;Notifications&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;notificationHeader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;notificationHeader&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;//...add any other drawer screens you'd like to see here in the menu (i.e. Home, Settings)&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;Once the DrawerNavigator is created, we will want to add a StackNavigator to each one of the drawer screens, as such:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createDrawerNavigator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-navigation-drawer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createStackNavigator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-navigation-stack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Notifications&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../menu/Notifications&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// this is the Notifications screen component&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;notificationHeader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createStackNavigator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;Notifications&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;screen&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Notifications&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="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;navigationOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;headerMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;screen&lt;/span&gt;&lt;span class="dl"&gt;'&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="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;With these StackNavigator(s) within the DrawerNavigator, you should now see the 'Notifications' screen have the header 'Notifications' once you refresh your screen!&lt;/p&gt;

&lt;p&gt;Based on my understanding, the DrawerNavigator does not have an headerMode option, since the DrawerNavigator is typically just a means to give you a visual hierarchy of screens. To create a header for the screens within DrawerNavigator, you need to create a StackNavigator for each individual screen and then this will then allow the screen to have a visible header.&lt;/p&gt;

&lt;p&gt;This seemed to be the only option that helped me resolve this issue. If you have ever dealt with this in a different or more efficient way, let me know in the comments! &lt;/p&gt;

&lt;p&gt;Happy coding :) &lt;/p&gt;

&lt;p&gt;Sources: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/react-navigation/react-navigation/issues/1632"&gt;https://github.com/react-navigation/react-navigation/issues/1632&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://itnext.io/the-intricacies-of-nesting-navigators-in-react-native-using-react-navigation-fef52ca72964"&gt;https://itnext.io/the-intricacies-of-nesting-navigators-in-react-native-using-react-navigation-fef52ca72964&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Learning about CSS architecture</title>
      <dc:creator>Kelliann Lafferty</dc:creator>
      <pubDate>Sun, 22 Dec 2019 05:27:12 +0000</pubDate>
      <link>https://forem.com/klaffert/learning-about-css-architecture-3fk</link>
      <guid>https://forem.com/klaffert/learning-about-css-architecture-3fk</guid>
      <description>&lt;p&gt;As I dive deeper into Javascript and its accompanying libraries and frameworks, I’m learning more about CSS and the many ways that I can structure my styling that both makes sense for the project and deliver cleaner code. Since I was not aware of CSS architecture outside of CSS stylesheets and inline styling, I thought I’d share some additional ways on how to use CSS in your project and when some methods may be more useful than others. &lt;/p&gt;

&lt;h4&gt;
  
  
  Stylesheet
&lt;/h4&gt;

&lt;p&gt;Probably the most well-known and (usually) simplest is the CSS stylesheet. This is what many of us have used when first being introduced to import stylesheets and injecting styling into our applications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;index.html
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"style.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Stylesheets definitely serve their purpose in smaller applications or ones that do not call for much styling at all. They can be very useful for beginners to understand the magic of CSS and how basic web application files work together to make a fully-fledged webpage. Another benefit is that a single CSS stylesheet can be cached by the browser only once, which will remove the need for returning users' browsers to download the file again. However, if we have larger applications or applications that can be built to scale, stylesheets can quickly become very large and incomprehensible. Thankfully, there are other options for these cases! &lt;/p&gt;

&lt;h4&gt;
  
  
  CSS Modules
&lt;/h4&gt;

&lt;p&gt;As in most software systems, the risk of regression is something also to consider when deciding upon your CSS architecture. The &lt;a href="https://www.cmcrossroads.com/article/risk-regression"&gt;risk of regression&lt;/a&gt; is the idea that as a system or application ages and expands, the likelihood that any updates made having unforeseen consequences increases. However, to minimize the risk of regression in terms of CSS architecture, CSS modules are a useful resource. &lt;/p&gt;

&lt;p&gt;Put simply, CSS modules are "CSS files in which all class names and animation names are scoped locally by default". This means that all components will have automatically-generated unique class names that are specific to that individual component. To use CSS modules, you will write your markup within your .js file as such:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;classes&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="s2"&gt;`&amp;lt;div class="&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;classes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&amp;gt;`&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If we were to open our generated HTML file, we would see that our &lt;/p&gt; class name would be given a randomized name such as:&lt;br&gt;

&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"App__App__2NQx7"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;whereas, our generated CSS file would have this related class name:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.App__App__2NQx7&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&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;p&gt;&lt;a href="https://github.com/css-modules/css-modules"&gt;CSS Modules&lt;/a&gt; allow you to have multiple components that all have unique, specific class names to avoid duplication and confusion. These are especially useful for larger applications and ones where scoped styling could be especially useful.  &lt;/p&gt;

&lt;h4&gt;
  
  
  CSS-in-JS
&lt;/h4&gt;

&lt;p&gt;There are quite a few frameworks out there that make using CSS in your Javascript as simple as possible. &lt;a href="https://blog.bitsrc.io/9-css-in-js-libraries-you-should-know-in-2018-25afb4025b9b"&gt;Here&lt;/a&gt; are a few listed for 2019. In CSS-in-JSS packages, the styles are scoped and class names are hashed, quite similarly to CSS Modules. &lt;/p&gt;

&lt;p&gt;In CSS-in-JS packages, you write CSS as you normally would for each component and the CSS framework then compiles the application and creates unique classnames. A major difference between CSS Modules and CSS-in-JS packages is that the CSS styling will only be returned for the components that are rendered on the page at that time. This allows more overall quicker load times and does not block rendering. &lt;/p&gt;

&lt;p&gt;To learn more about CSS-in-JSS or any of the other methods mentioned in this article, I'd highly suggest checking out the articles linked below and the &lt;a href="https://css-tricks.com/"&gt;CSS Tricks&lt;/a&gt; site. It has a ton of useful information and new and innovative ways to use CSS in your applications! &lt;/p&gt;

&lt;h4&gt;
  
  
  Useful Resources
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://css-tricks.com/the-many-ways-to-include-css-in-javascript-applications/"&gt;The Many Ways to Include CSS in JavaScript Applications&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://css-tricks.com/css-modules-part-1-need/"&gt;What are CSS Modules and why do we need them?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>css</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
