<?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: Omar Alshaker</title>
    <description>The latest articles on DEV Community by Omar Alshaker (@alshakero).</description>
    <link>https://dev.to/alshakero</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%2F50679%2F5591bab1-af02-41e8-a0ce-dbbea2c06265.jpeg</url>
      <title>DEV Community: Omar Alshaker</title>
      <link>https://dev.to/alshakero</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alshakero"/>
    <language>en</language>
    <item>
      <title>4 Creative Ways to JavaScript Timing in Browsers</title>
      <dc:creator>Omar Alshaker</dc:creator>
      <pubDate>Sat, 15 Feb 2020 13:38:28 +0000</pubDate>
      <link>https://dev.to/alshakero/4-creative-ways-to-javascript-timing-in-browsers-5985</link>
      <guid>https://dev.to/alshakero/4-creative-ways-to-javascript-timing-in-browsers-5985</guid>
      <description>&lt;p&gt;&lt;cite&gt;&lt;small&gt;Photo by Lukas Blazek on Unsplash&lt;/small&gt;&lt;/cite&gt;&lt;/p&gt;

&lt;p&gt;This article assumes the availability for Web APIs, therefore, most methods suggested here don't work in NodeJS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using an infinite synchronous loop in a Web Worker (not Service Worker)
&lt;/h2&gt;

&lt;p&gt;Since Web Workers are essentially web threads, you can infinitely loop inside them without blocking the main thread. This gives you access to sub-millisecond time resolutions. This is especially good to make time critical decisions within the worker, and let the main thread know when (&lt;em&gt;accurately&lt;/em&gt;) you see fit. Eg. Rerender something whenever microseconds are a prime number. To get access to microseconds, you can use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Performance/now"&gt;&lt;code&gt;performance.now&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Pros and cons
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Pros
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; Sub-millisecond resolution.&lt;/li&gt;
&lt;li&gt; Near zero cost on the UI thread.&lt;/li&gt;
&lt;li&gt; Fully asynchronous from a UI thread perspective. Thanks to Web Workers messaging design.&lt;/li&gt;
&lt;li&gt; Safe ending. Unlike &lt;code&gt;setInterval&lt;/code&gt;, calling &lt;code&gt;worker.terminate&lt;/code&gt; guarantees no more messages will be received. Quoting MDN, "The terminate() method of the Worker interface immediately terminates the Worker. This does not offer the worker an opportunity to finish its operations; it is simply stopped at once."&lt;/li&gt;
&lt;/ol&gt;

&lt;h5&gt;
  
  
  Cons
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; Even though you can make sub-millisecond decisions, messaging back to the UI thread is asynchronous. You can't render as timely as you make the decision in the worker.&lt;/li&gt;
&lt;li&gt; Keeps a thread fully occupied. Might be heavy on phone batteries.&lt;/li&gt;
&lt;li&gt; Requires Web Worker support.&lt;/li&gt;
&lt;li&gt; Doesn't pause when the tab isn't focused.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Codesandbox example
&lt;/h4&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/web-worker-timer-eiczf"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Using CSS animations for time events (particularly &lt;code&gt;animationiteration&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;If you create a &lt;code&gt;div&lt;/code&gt; (don't use a div though, see point 2 of cons) with an infinite animation. You can subscribe to its &lt;code&gt;animationiteration&lt;/code&gt; event and get notified whenever &lt;code&gt;animation-duration&lt;/code&gt; passes.&lt;/p&gt;

&lt;h5&gt;
  
  
  Pros
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; Automatic suspension when the tab isn't in focus. The event doesn't fire at all when the tab isn't in focus. You don't need to worry about jammed calls that will all run at once when the tab is in focus again.&lt;/li&gt;
&lt;li&gt; Automatic clean up when the your hidden div is removed from the DOM. For example, if you have a React component that renders the time, you don't need to do anything on unmounting. The div will me removed and the event will not fire anymore.&lt;/li&gt;
&lt;li&gt; This is subjective but the subscription logic is beautiful. Eg. &lt;code&gt;.addEventListener("animationiteration", fun)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; Super clean way to delay the start of the timer by using &lt;code&gt;animation-delay&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h5&gt;
  
  
  Cons
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; A little too clever, might confuse your teammates/contributors.&lt;/li&gt;
&lt;li&gt; Depends on the DOM and CSSOM. Other CSS rules can interfere with yours. That's why I suggest to create an arbitrary non-existent tag like &lt;code&gt;&amp;lt;just-a-timer-element&amp;gt;&amp;lt;/&amp;lt;just-a-timer-element&amp;gt;&lt;/code&gt;. Maybe create a custom element with the CSS animation code neatly tucked within? 🤯 (don't come after me, kthx).&lt;/li&gt;
&lt;li&gt; Doesn't work if the element has &lt;code&gt;display: none;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; Inaccurate. According to my testing, it can be off by a full &lt;code&gt;1ms&lt;/code&gt;. You can try yourself in the example CSB below.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Codesandbox example
&lt;/h4&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/css-animation-timer-fvssk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Using SVG  tag (SMIL Animations)
&lt;/h3&gt;

&lt;p&gt;If you do &lt;code&gt;animate.addEventListener('repeat', fun)&lt;/code&gt;, your function will be called every &lt;code&gt;dur&lt;/code&gt; (1s) period.&lt;/p&gt;

&lt;h5&gt;
  
  
  Pros
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; Works even when the SVG is &lt;code&gt;display: none;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; Stops automatically when the SVG is removed from the DOM.&lt;/li&gt;
&lt;li&gt; Doesn't begin until full page load.&lt;/li&gt;
&lt;li&gt; Auto-pauses when the tab isn't in focus.&lt;/li&gt;
&lt;/ol&gt;

&lt;h5&gt;
  
  
  Cons
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; A little too clever, might confuse your teammates/contributors.&lt;/li&gt;
&lt;li&gt; Depends on the DOM and CSSOM. Same caveats as above. Other CSS rules can interfere with your configuration.&lt;/li&gt;
&lt;li&gt; Isn't supported in IE and Edge (before Chromium).&lt;/li&gt;
&lt;li&gt; Inaccurate. According to my testing, it can be off by a whopping 15ms. You can try yourself in the example CSB below.&lt;/li&gt;
&lt;li&gt; Doesn't begin until full page load. Yup, can be a bug and a feature.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Codesandbox example
&lt;/h4&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/css-animation-timer-u8zun"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Web Animations API
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API"&gt;Web Animations API&lt;/a&gt; allows you to animate DOM elements from within JavaScript.&lt;/p&gt;

&lt;p&gt;Interestingly, you can animate unmounted elements! This gives you access to a timing mechanism in pure JS (and Web APIs).&lt;/p&gt;

&lt;p&gt;Here is an alternative implementation of &lt;code&gt;setTimeout&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ownSetTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;duration&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="nx"&gt;div&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;keyframes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;KeyframeEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;div&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;duration&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;iterations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;animation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Animation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;keyframeRequestAnimationFrames&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;timeline&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;play&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nx"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;finish&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;callback&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;Neat, isn't it?&lt;/p&gt;

&lt;h5&gt;
  
  
  Pros
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; Atomic. Doesn't need DOM interactions.&lt;/li&gt;
&lt;li&gt; Easy to understand by an unfamiliar person.&lt;/li&gt;
&lt;li&gt; Pauses when the tab isn't focused.&lt;/li&gt;
&lt;/ol&gt;

&lt;h5&gt;
  
  
  Cons
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt; Still a proposal. Don't use in production.&lt;/li&gt;
&lt;li&gt; Dire support situation. Probably only works in Chromium.&lt;/li&gt;
&lt;li&gt; Still a little counterintuitive.&lt;/li&gt;
&lt;li&gt; Pauses when the tab isn't focused. Can be bad if used as an alternative for &lt;code&gt;setTimeout&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; Can't be used for intervals. Only &lt;code&gt;onfinish&lt;/code&gt; event is available.&lt;/li&gt;
&lt;li&gt; Inaccurate. According to my testing, ±5ms can happen easily.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Codesandbox example
&lt;/h4&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/svg-animate-as-timer-duv5q"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  This was fun
&lt;/h2&gt;

&lt;p&gt;I realize this is a niche article. But I felt compelled to write it because I always thought &lt;code&gt;setTimeout&lt;/code&gt; and &lt;code&gt;setInterval&lt;/code&gt; were the only paths towards asynchronous delays and intervals. But turns out there are a few other options! And who knows, someone might have some strange constraints and might find this useful.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Do Not Use Your Employer's Email Account to Negotiate Anything Legal </title>
      <dc:creator>Omar Alshaker</dc:creator>
      <pubDate>Tue, 11 Jun 2019 09:36:32 +0000</pubDate>
      <link>https://dev.to/alshakero/do-not-use-your-employer-s-email-account-to-negotiate-anything-legal-2k9h</link>
      <guid>https://dev.to/alshakero/do-not-use-your-employer-s-email-account-to-negotiate-anything-legal-2k9h</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wBfF_xaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fdpiucxdqt9hqmq03cxk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wBfF_xaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/fdpiucxdqt9hqmq03cxk.jpg" alt="Image"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Photo by Samuel Zeller on Unsplash&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;TL;DR: because they can delete everything. &lt;/p&gt;

&lt;p&gt;By employer's email account I mean something like &lt;code&gt;you@youremployersdomain.com&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;I recently parted ways with my previous employer. It all went super smoothly and my previous employer was nothing but super nice and compassionate. However, after a while, they naturally shut down my email account. And I was so close to losing some important documents like contracts, hardware receipts, promotion agreements, and such. Luckily I had a copy of everything on my email client and I could save a backup. But it made me realize that my employer had absolute power over my account all along. I trust my previous employer with this power, they're great people, but why trust when you can know?&lt;/p&gt;

&lt;p&gt;Obviously, it is normal to use the company's email for work-related communication, but when it comes to negotiating your very contract, the counterparty shouldn't have access to deleting your side of the argument. Use your personal email when negotiating your salary, contract, or whatever unshared interest with your employer. &lt;/p&gt;

&lt;p&gt;This is especially relevant for remote workers where contracts and negotiations are mostly digital. &lt;/p&gt;

</description>
      <category>work</category>
      <category>email</category>
      <category>employer</category>
      <category>contract</category>
    </item>
    <item>
      <title>[advice needed] Using a huge distant monitor</title>
      <dc:creator>Omar Alshaker</dc:creator>
      <pubDate>Thu, 06 Dec 2018 17:52:40 +0000</pubDate>
      <link>https://dev.to/alshakero/advice-needed-using-a-huge-distant-monitor-ofj</link>
      <guid>https://dev.to/alshakero/advice-needed-using-a-huge-distant-monitor-ofj</guid>
      <description>&lt;p&gt;My vision is considerably deteriorating due to my lifestyle. Pretty much 80% of my waking time I'm focusing on &amp;lt;2m away objects/monitors/screens.&lt;/p&gt;

&lt;p&gt;I'm considering a ~56" TV that I would hang 5m away from me to relax my eyes a bit. But I'm wary of this solution because I have never seen such setup.&lt;/p&gt;

&lt;p&gt;Anyone has tried/seen this before?&lt;/p&gt;

&lt;p&gt;Any links to stories would be appreciated, too.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>health</category>
      <category>ergonomics</category>
    </item>
    <item>
      <title>[discontinued] Run a green-badge local HTTPS server with zero configuration</title>
      <dc:creator>Omar Alshaker</dc:creator>
      <pubDate>Mon, 30 Jul 2018 18:20:48 +0000</pubDate>
      <link>https://dev.to/alshakero/run-a-green-badge-local-https-server-with-zero-configuration-30lh</link>
      <guid>https://dev.to/alshakero/run-a-green-badge-local-https-server-with-zero-configuration-30lh</guid>
      <description>

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3NOTXyMn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/199fub9gos4wks74r312.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3NOTXyMn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/199fub9gos4wks74r312.jpg" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⚠️ Apparently, this goes against letsencrypt's ToS and I can't use their certificates in such manner. And I have to drop this tool. I would have issued a non-free certificate to keep this tool up, but it doesn't sound like a great idea to publish a private key that is officially registered to my name.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;No certificate creation, no tunnels and no hassle ⚡️&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;The importance of using HTTPS locally&lt;/h3&gt;

&lt;p&gt;One might assume that HTTPS isn’t needed for local development. But that’s not always the case. You need to test for mixed-content, secure cookies, service workers, etc. This thread by @getify makes the point perfectly.&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;&lt;div class="ltag__twitter-tweet__main"&gt;
&lt;div class="ltag__twitter-tweet__header"&gt;
&lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ocOeSls8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/938120772932923392/O7aZNh4w_normal.jpg"&gt;&lt;div class="ltag__twitter-tweet__full-name"&gt;getify&lt;/div&gt;
&lt;div class="ltag__twitter-tweet__username"&gt;@getify&lt;/div&gt;
&lt;div class="ltag__twitter-tweet__twitter-logo"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kX-SksTr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-eb8b335b75231c6443385ac04fdfcaed8ca5423c3990e89dc0178a4090ac1908.svg"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="ltag__twitter-tweet__body"&gt;I so often get re-explaining from others that "localhost doesn't need local https". eyeroll.&lt;br&gt;&lt;br&gt;this is not universally true. this tweet thread is the last time i'm gonna explain. henceforth it will just be linked to.&lt;/div&gt;
&lt;div class="ltag__twitter-tweet__date"&gt;13:42 PM - 28 Jul 2018&lt;/div&gt;
&lt;div class="ltag__twitter-tweet__actions"&gt;
&lt;a href="https://twitter.com/intent/tweet?in_reply_to=1023202051902373888" class="ltag__twitter-tweet__actions__button"&gt;&lt;img src="/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;&lt;/a&gt;&lt;a href="https://twitter.com/intent/retweet?tweet_id=1023202051902373888" class="ltag__twitter-tweet__actions__button"&gt;&lt;img src="/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;&lt;/a&gt;457&lt;a href="https://twitter.com/intent/like?tweet_id=1023202051902373888" class="ltag__twitter-tweet__actions__button"&gt;&lt;img src="/assets/twitter-like-action.svg" alt="Twitter like action"&gt;&lt;/a&gt;1071&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;

&lt;p&gt;Running a local HTTPS server can be pain in the neck. You have to create your own certificates, add them as trusted etc. You know the deal.&lt;/p&gt;

&lt;p&gt;Using tunnels, at least the freely-available choices, isn’t the best experience either, they create a different URL everytime, they can get really slow, and 3rd parties will have access to your app in plain text.&lt;/p&gt;

&lt;p&gt;But what if you could use a static, short and memorable URL to access your app without 3rd parties involvement? ez-s does exactly that. You run &lt;code&gt;ez-s&lt;/code&gt; and access &lt;code&gt;https://ez-s.io&lt;/code&gt; and you’ll see your app with a green badge.&lt;/p&gt;

&lt;h3&gt;What is EZ-S?&lt;/h3&gt;

&lt;p&gt;It’s a fork of &lt;a href="https://github.com/zeit/serve"&gt;zeit/serve&lt;/a&gt; that gives you the ability to locally run a green-badge HTTPS server. You can see it on GitHub &lt;a href="https://github.com/alshakero/ez-s"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Quick steps&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; @alshakero/ez-s
&lt;span class="nv"&gt;$ &lt;/span&gt;ez-s
&lt;span class="c"&gt;# =&amp;gt; go to https://ez-s.io to see your app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;How does it works?&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;The domain ez-s.io has a single A DNS record pointing to the IP address 127.0.0.1.&lt;/li&gt;
&lt;li&gt; ez-s package includes SSL certificates generated by letsencrypt.&lt;/li&gt;
&lt;li&gt;There is also a small HTTPS server that uses the aforementioned certificates including the private key. So when you access ez-s.io the certificate provided will actually match letsecrypt's, and you get a green badge. The IP address of the host does not matter. As long as letsencrypt records match the certificates provided by the server, Chrome will not object.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Wait what? Public private keys?! Yes. Because the domain will forever point to 127.0.0.1, impersonating it will not take the impersonator anywhere. Unless the impersonator has power over the victim’s DNS server, which makes ez-s the least of the victim’s worries 😁&lt;/p&gt;

&lt;h3&gt;Caveat&lt;/h3&gt;

&lt;p&gt;Since ez-s.io points to &lt;code&gt;127.0.0.1&lt;/code&gt;, your app will be only accessible locally. You can't test it on your phone or using another machine.&lt;/p&gt;

&lt;p&gt;Due to this caveat, serve's &lt;code&gt;--listen&lt;/code&gt; argument is useless in this case. The only configurble network-related parameter is the port (&lt;code&gt;-p&lt;/code&gt; or &lt;code&gt;--port&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;Questions&lt;/h3&gt;

&lt;p&gt;If you have any questions please go ahead and comment below.&lt;/p&gt;


</description>
      <category>ssl</category>
      <category>https</category>
      <category>serviceworker</category>
      <category>node</category>
    </item>
    <item>
      <title>The True Delight of React’s Error and Warning Messages</title>
      <dc:creator>Omar Alshaker</dc:creator>
      <pubDate>Sat, 07 Jul 2018 12:25:07 +0000</pubDate>
      <link>https://dev.to/alshakero/the-true-delight-of-reacts-error-and-warning-messages-168j</link>
      <guid>https://dev.to/alshakero/the-true-delight-of-reacts-error-and-warning-messages-168j</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqlhwsei92auehdgki3sg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqlhwsei92auehdgki3sg.jpg" alt="Photo by [Štefan Štefančík](https://unsplash.com/@cikstefan) on [Unsplash](https://unsplash.com/photos/pzA7QWNCIYg?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText)"&gt;&lt;/a&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/photos/pzA7QWNCIYg?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Štefan Štefančík&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/pzA7QWNCIYg?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;There is this fascinating idea that hasn’t left me for years now, that software developers, with all their prejudices, biases, and humanness in general, shape the world around us.&lt;/p&gt;

&lt;p&gt;Think about it. Software, just like music, is an &lt;a href="https://en.wikipedia.org/wiki/Intangible_good" rel="noopener noreferrer"&gt;intangible good&lt;/a&gt;. It’s not wine or chocolate where raw materials can limit the product quantity then the number of people who enjoy it. There exists thousands of software pieces that are written by individuals on a Saturday night and are used by millions of people everywhere.&lt;/p&gt;

&lt;p&gt;It’s fair to say that those individuals have an impact, small or big, on people’s lives. And even if we consider corporations, the number of people who produce software is a microscopic number in relation to the number of said software users. For instance, &lt;a href="https://www.developer.com/daily_news/samsung-employs-twice-as-many-software-engineers-as-google.html" rel="noopener noreferrer"&gt;Google has ~18K&lt;/a&gt; engineers worldwide, while around &lt;a href="https://www.statista.com/chart/899/unique-users-of-search-engines-in-december-2012/" rel="noopener noreferrer"&gt;1.17 billion people use Google&lt;/a&gt;, that’s a ratio of 0.000015%. We can see the huge dependence on software developers’ opinions and ideas to shape the world. There is obviously a developer society and a sub-culture. And if a meme or an idea spreads in this society, it would inevitably shape the technology used by everyone.&lt;/p&gt;

&lt;p&gt;Now imagine, in a sci-fi kind of way, that there is an imaginary software technology that solves a world problem. Say it can cure cancer or completely eliminate poverty. &lt;em&gt;But&lt;/em&gt;, this technology has the cost of ruining the life of the software developer who uses it. Would that technology ever see the light? Hardly. This imaginary story is an extreme example of the conflict of interest between the software developer and the end user. If good software meant the developer being uncomfortable, we will not see good software. And a big part of software developers’ lives is error messages. They’re key to the experience, and paying attention to them goes a long long way. They are directly important to the developer, and indirectly important to everyone of us.&lt;/p&gt;

&lt;h2&gt;
  
  
  React
&lt;/h2&gt;

&lt;p&gt;Of all the libraries and packages I’ve used in the last ~10 years, I haven’t seen a library where errors and warnings are as beautiful. Developers, including me, usually try to detect errors that break their own code and report them to the user along with the data they have on hand (scope?). Maybe mention the most common mistake that can cause the error along with an automatically-generated stack trace and that’s it.&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="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;not&lt;/span&gt; &lt;span class="nx"&gt;an&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But with React, the library works overtime trying to guess for you what went wrong. The error guessing effort is quite obvious and it’s tremendously helpful; it saves you a lot of time debugging and tries its best to save your day.&lt;/p&gt;

&lt;p&gt;To help you enjoy the experience like I do writing React apps, I’ll make this article a ride. I’ll show React snippets with mistakes in them, you may try to find the issue or just look at the warning/error below and decide whether it would be helpful for you. This is not to list every message React logs. It’s a very small sample for inspiration.&lt;/p&gt;

&lt;p&gt;Let’s start!&lt;/p&gt;

&lt;h3&gt;
  
  
  1. A simple one
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;componentWillMount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Component mounted!&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s wrong with this component?&lt;/p&gt;

&lt;p&gt;Here is the message:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: MyComponent(…): No `render` method found on the returned component instance: you may have forgotten to define `render`.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Beautiful, isn’t it? &lt;strong&gt;The component name&lt;/strong&gt; and a correct suggestion. Super easy to fix.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. A trickier one
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;componentDidUnmount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Unmounted!&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="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hi!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;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;What’s the issue here?&lt;/p&gt;

&lt;p&gt;Here is the message:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: MyComponent has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;React went out of its way here. It expected you to make this mistake and waited for you there. Silence wouldn’t break React in this case, it would only break your app. Quite sympathetic of the library.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. A little obvious one
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&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="nx"&gt;state&lt;/span&gt; &lt;span class="o"&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;Omar&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="nf"&gt;render&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="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;Not Omar&lt;/span&gt;&lt;span class="dl"&gt;'&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hi &lt;span class="si"&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;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;What’s the issue?&lt;/p&gt;

&lt;p&gt;Here is the warning:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: Cannot update during an existing state transition (such as within `render` or another component’s constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to `componentWillMount`.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  4. Not quite obvious
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&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="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;John&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="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hi &lt;span class="si"&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;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;What’s the issue?&lt;/p&gt;

&lt;p&gt;Here is the message:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: setState(…): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op.

Please check the code for the MyComponent component.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  5. Pure elegance
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s wrong with type here?&lt;/p&gt;

&lt;p&gt;Here is the warning:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: Received `true` for non-boolean attribute `type`. If this is expected, cast the value to a string.
 in input
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And that’s another example of an error that doesn’t affect React, rather affects your app.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. The beginner’s rescuer
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;greetingComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hi!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;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;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;greetingComponent&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The two warnings:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: &amp;lt;greetingComponent /&amp;gt; is using uppercase HTML. Always use lowercase HTML tags in React.

Warning: The tag &amp;lt;greetingComponent&amp;gt; is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I definitely fell for this at least once.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. OK I fixed it, but it still doesn’t work
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hi!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;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;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
  &lt;span class="nx"&gt;GreetingComponent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s wrong now?&lt;/p&gt;

&lt;p&gt;The message:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: Functions are not valid as a React child. This may happen if you return a Component instead of &amp;lt;Component /&amp;gt; from render. Or maybe you meant to call this function rather than return it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Yup, it should be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;,&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. A very common mistake in the first couple days
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bold"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;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;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What’s up here?&lt;/p&gt;

&lt;p&gt;The message:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning: Invalid DOM property `class`. Did you mean `className`?
 in h1 (created by GreetingComponent)
 in GreetingComponent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Enough data to land you exactly at your mistake&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Why don’t you come back? 🎼
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;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;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You said goodbye&lt;br&gt;
I was trying to hide what I felt inside&lt;br&gt;
Until you passed me by&lt;br&gt;
You said you’d return &lt;br&gt;
Will you ever return? 🎵&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Uncaught Error: GreetingComponent(…): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  10. And the one that doesn’t need an example:
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;This one is a personal favorite.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Obviously, I haven’t used every framework and library ever existed. And there may be better examples of nice and helpful error messages. But as a frontend developer, I can safely say that React easily stands out. I’ve been inspired by it and now I am trying my best to guess the areas my code users could make mistakes, and provide them with eleborate and helpful error messages when they do. For I am a true believer that a better developer experience means a better world.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you know some other nice examples of React warnings, please feel free to mention them in the comments and I’ll add them.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This was also published on &lt;a href="https://codeburst.io/the-true-delight-of-reacts-error-and-warning-messages-137002a3bbd4" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>errors</category>
      <category>devrel</category>
    </item>
    <item>
      <title>My Thoughts on Working Remotely, One Year in</title>
      <dc:creator>Omar Alshaker</dc:creator>
      <pubDate>Fri, 29 Jun 2018 17:08:17 +0000</pubDate>
      <link>https://dev.to/alshakero/my-thoughts-on-working-remotely-one-year-in-1n2b</link>
      <guid>https://dev.to/alshakero/my-thoughts-on-working-remotely-one-year-in-1n2b</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdnyolqqadazerc7zksv5.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdnyolqqadazerc7zksv5.jpeg" alt="Barefoot to the Moon album cover by Echoes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A little intro
&lt;/h2&gt;

&lt;p&gt;It’s been a little more than a year since I joined &lt;a href="https://www.starcounter.com" rel="noopener noreferrer"&gt;Starcounter&lt;/a&gt;. Working full-time as a Javascript developer mostly on &lt;a href="https://palindrom.github.io" rel="noopener noreferrer"&gt;Palindrom&lt;/a&gt;, &lt;a href="https://github.com/Palindrom/JSONPatcherProxy" rel="noopener noreferrer"&gt;JSONPatcherProxy&lt;/a&gt;, and &lt;a href="https://github.com/Starcounter-Jack/JSON-Patch/" rel="noopener noreferrer"&gt;fast-json-patch&lt;/a&gt;. All the team I work with is in the same timezone. We use Github, Slack and Google Hangouts for meetings.&lt;/p&gt;

&lt;p&gt;I have never been happier and more satisfied with my life than I am now. It’s been a great year and I learned much more than I ever thought I will before I started.&lt;/p&gt;

&lt;p&gt;Before I dive in, it is important to note that a lot of this experience has to do with my nature and my personality; everything I say in this post only applies to me, and may or may not apply to other people.&lt;/p&gt;

&lt;h2&gt;
  
  
  Socially
&lt;/h2&gt;

&lt;p&gt;One the personal level, I truly enjoy socializing. But the way I define socializing is meeting once a week for a couple hours. I tend to think that meeting people every morning is a burden. And working remotely is a godsend for me.&lt;/p&gt;

&lt;p&gt;However, in this year I learned several lessons when it comes to socializing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Your social attitude is as important as your skill set&lt;/strong&gt;. We are social animals after all. Internally, I have never decided whether I liked a workmate based on how clean their code was. Or how their jsperf results scored. As much as I try to be professional and objective, I find myself liking and respecting nicer workmates more. And obviously, this applies to me too. And proving yourself nice remotely is harder than in real life.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Networking is a different challenge when working remotely.&lt;/strong&gt; There is no coffee break or lunch chitchat**. **You’ll have to step up your social media game, conference attendance and other networking activities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;We project on people&lt;/strong&gt;. In real life, we project all the time. We don’t know enough about people to understand them, so we assume a lot about them to sympathize (or the opposite) and understand what they’re saying without much effort. This can be a good thing, but can easily go wrong. When working remotely, you know less, so you assume more. When I first met my team after two months of text communication I was astonished how nice and cheerful they are. I painted wildly different images of every one of them based on the way they communicated on Slack. Not to say that my imagination was grim, but it was largely off. This was eye-opening for me.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Seeing the informal side of my workmates was key.&lt;/strong&gt; It was key to seeing them as nice human beings who joke, have fun and have some weaknesses just like I do. Partying with my teammates helped me a great deal to feel secure about myself, to express who I am as a person (not an engineer). And this is a two-way street, it helped me to know who they are, as people, not robotic professionals.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What I learned from the above is that &lt;strong&gt;meeting the team was absolutely essential for my morale, satisfaction, and mutual trust.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The efficiency factor
&lt;/h2&gt;

&lt;p&gt;One of the upsides of text communication is the ability to think, research and even later-edit what you have to say. When a workmate asks me a question on Slack, I give them a solid well-researched answer with links to specific lines of code. This saves us a lot of time and energy. Every question is a chance to learn and feel more confident.&lt;/p&gt;

&lt;p&gt;Also, I rely much less on memory now. I can go back to any conversation I want, and I use Slack search all the time to do that. Even though Slack uses a ton of memory, at least it’s not mine 😄. To me this is a priceless upside; I always struggled to remember the conclusions made in a meeting three days later. This gives me a clear head and the ability to only process one thing at a time. Because I don’t even try to memorize conversations anymore.&lt;/p&gt;

&lt;p&gt;There is no lack of wishing sometimes that I could walk up to a workmate and ask them a quick question and instantly get my answer and move on. But the experience is close enough on Slack.&lt;/p&gt;

&lt;p&gt;Another huge upside to remote work is readiness to work open-source. If you think about it, most of the time open-source work is remote work. You almost never meet your contributors nor the project owners of where you contribute. Having a job that trains you to work open-source is a blessing. I’m now trained to be unambiguous, direct and to more communicative. Add to that, most the libraries I work on are in fact open-source. This gives me endless satisfaction and pleasure.&lt;/p&gt;

&lt;p&gt;One thing I don’t know about is how much extra effort my workmates are putting to support me working remotely. I try my very best to eliminate that burden but I’m pretty sure there is an extra mile they walk sometimes to support the remote part of the team. I don’t have a decent insight on this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commuting
&lt;/h2&gt;

&lt;p&gt;Now, I’m much more efficient than the times I used to commute. Personally, I find it hard to read or do anything constructive whlist commuting. Those are at least 60 minutes saved &lt;strong&gt;every&lt;/strong&gt; day, which I spend in the gym. In a nutshell, I work + exercise in the same amount of time a commuter only works, and with less focus and energy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Health
&lt;/h2&gt;

&lt;p&gt;Working from home is reputated to be unhealthy. Well, not in Warsaw. The only thing I can confess to missing is morning sunlight. But there isn’t a lot of it either ways here. And I try to make up for that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;I go out in the morning during weekends.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I work with a huge window next to me that is always uncurtained.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And smog is a big issue in Warsaw nowadays, so staying in can be even healthier than commuting to downtown everyday at peak pollution hours.&lt;/p&gt;

&lt;p&gt;Regarding sitting for a long time. Working in an office isn’t a whole lot better. So remote or not, without going to the gym, my job would be extremely unhealthy. I can’t stress this enough; &lt;strong&gt;going to gym is crucial to my health now.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Food
&lt;/h2&gt;

&lt;p&gt;Another cool thing about working from home is the food. Everyday I have a decent breakfast. And recently I started cooking my lunch the night before. When it’s lunch time, I heat my food and make some salad in quick ten minutes, and enjoy every bite of it. Much healthier than eating at work; has the exact amount of protein and other nutrients that I plan to eat.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I would definitely recommend working remotely for a friend, but they need to make sure to meet their team occassionally, exercise and always give the benefit of the doubt when things are unclear. It’s also very important to find alternative ways for networking and self marketing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is my first post here, please excuse any mistakes or errors.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This was originally posted on &lt;a href="https://codeburst.io/my-thoughts-on-working-remotely-one-year-in-c6fe20ba1eb0" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>remote</category>
      <category>workingfromhome</category>
      <category>health</category>
    </item>
  </channel>
</rss>
