<?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: alanmynah</title>
    <description>The latest articles on DEV Community by alanmynah (@alanmynah).</description>
    <link>https://dev.to/alanmynah</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%2F121760%2F5bc450f0-f6a3-47cc-a34b-00278b293752.jpeg</url>
      <title>DEV Community: alanmynah</title>
      <link>https://dev.to/alanmynah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alanmynah"/>
    <language>en</language>
    <item>
      <title>Learn Command Line</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Wed, 28 Jul 2021 17:08:43 +0000</pubDate>
      <link>https://dev.to/alanmynah/learn-command-line-37pe</link>
      <guid>https://dev.to/alanmynah/learn-command-line-37pe</guid>
      <description>&lt;p&gt;This is a cheat-sheet to go along with &lt;a href="https://www.youtube.com/watch?v=kLmt437GfTY"&gt;the stream I did on Scrimba YouTube channel about command line&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Command Line notes
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Where am i? What's here? How do i console.log?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;pwd
ls
echo&lt;/span&gt; &lt;span class="s1"&gt;'hello Scrimba!'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CRU(M)D
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# create&lt;/span&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;cmd-session
&lt;span class="nb"&gt;cd &lt;/span&gt;cmd-session
&lt;span class="nb"&gt;touch &lt;/span&gt;script.sh

&lt;span class="nb"&gt;mkdir &lt;/span&gt;sub-folder

&lt;span class="c"&gt;# read&lt;/span&gt;
&lt;span class="nb"&gt;ls &lt;/span&gt;sub-folder
&lt;span class="nb"&gt;cat &lt;/span&gt;script.sh

&lt;span class="c"&gt;# move/update&lt;/span&gt;
&lt;span class="nb"&gt;mv &lt;/span&gt;script.sh sub-folder/script.sh
&lt;span class="nb"&gt;mv &lt;/span&gt;script.sh new-name-new-file.sh

&lt;span class="c"&gt;# delete&lt;/span&gt;
&lt;span class="nb"&gt;rm &lt;/span&gt;script.sh
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; sub-folder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Execute
&lt;/h2&gt;

&lt;p&gt;Create a &lt;code&gt;script.sh&lt;/code&gt;, example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# touch script.sh, open it and write something like:&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"hello, running script!"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"where am i?"&lt;/span&gt;
&lt;span class="nb"&gt;pwd
echo&lt;/span&gt; &lt;span class="s2"&gt;"ok, let's go somewhere else!"&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /code
&lt;span class="nb"&gt;pwd
echo&lt;/span&gt; &lt;span class="s2"&gt;"that's better"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To execute a script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./script.sh

&lt;span class="c"&gt;### oh no, permission denied! what now?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Permissions
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# see permissions&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;span class="c"&gt;# they are repeated, 3 times, for user (owner of the file), group of users, everyone else.&lt;/span&gt;
&lt;span class="c"&gt;# -rwx - read, write, execute&lt;/span&gt;
&lt;span class="c"&gt;# to change permissions&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;u+x ./script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Alias
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;script&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'~/script.sh'&lt;/span&gt;
&lt;span class="c"&gt;# is this an alias?&lt;/span&gt;
&lt;span class="nb"&gt;type &lt;/span&gt;script
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Getting help and Man pages
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;--help&lt;/span&gt; &lt;span class="c"&gt;# -- is how you indicate a flag, -h is a shorthand, so node -h is the same.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For linux's own utilities, --help wouldn't work, so they have &lt;code&gt;man&lt;/code&gt; manual command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;man &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a more visually pleasant &lt;code&gt;man&lt;/code&gt; pages:&lt;br&gt;
&lt;a href="https://explainshell.com/"&gt;https://explainshell.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: Search
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'echo'&lt;/span&gt; ./script.sh

&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;body&amp;gt;'&lt;/span&gt; ./
&lt;span class="c"&gt;# grep: ./: Is a directory error, so you need to add recursive flag to search through directories&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;body&amp;gt;'&lt;/span&gt; ./
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>commandline</category>
      <category>bash</category>
      <category>scripting</category>
    </item>
    <item>
      <title>Github from scratch</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Wed, 02 Jun 2021 17:46:57 +0000</pubDate>
      <link>https://dev.to/alanmynah/github-from-scratch-383m</link>
      <guid>https://dev.to/alanmynah/github-from-scratch-383m</guid>
      <description>&lt;p&gt;This is a cheat-sheet to go along with &lt;a href="https://www.youtube.com/watch?v=DF_vp2kE2WY"&gt;the stream I did on Scrimba YouTube channel about git and GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've recently gone on a Scrimba Livestream to talk about git and Github. I love simple workflows with git and this is my cheat-sheet to use. Feel free to hit me up on twitter or Scrimba Discord if you have any questions. Also if you spot something not right, raise a PR 😉. (Details below)&lt;/p&gt;

&lt;h2&gt;
  
  
  Contributing to a repo
&lt;/h2&gt;

&lt;p&gt;Pick a repo, fork it (optional) and clone it.&lt;/p&gt;

&lt;p&gt;Alternatively, create a new one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# replace the below URL with the repo in your account that you want to work with&lt;/span&gt;
git clone https://github.com/alanmynah/alanmynahdotcom.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then just follow Branching steps&lt;/p&gt;

&lt;h2&gt;
  
  
  Branching
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# create a new branch and switch to it&lt;/span&gt;
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; new-branch
&lt;span class="c"&gt;# connect the local new branch to the remote counter part&lt;/span&gt;
git push &lt;span class="nt"&gt;--set-upstream&lt;/span&gt; origin new-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now follow the steps in My daily workflow&lt;/p&gt;

&lt;h2&gt;
  
  
  My daily workflow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# add all the files&lt;/span&gt;
git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="c"&gt;# commit&lt;/span&gt;
&lt;span class="c"&gt;# tips on helpful commit messages:&lt;/span&gt;
&lt;span class="c"&gt;# https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"type: brief description (&amp;lt;50 chars) of work done"&lt;/span&gt;
&lt;span class="c"&gt;# push&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a few commits, raise a PR.&lt;/p&gt;

&lt;p&gt;When done, don't forget to Pull after a PR&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull after a PR
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status &lt;span class="c"&gt;# should be on the branch&lt;/span&gt;
git checkout main
git pull
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then pick a new feature and create new branch as described in Branching section&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a repo
&lt;/h2&gt;

&lt;p&gt;Create a repository locally (like via CRA), go to &lt;a href="https://github.com/"&gt;github.com&lt;/a&gt;, create a repository via UI.&lt;/p&gt;

&lt;p&gt;Copy and paste the steps from the outline in &lt;code&gt;…or push an existing repository from the command line&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;These are the steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;create-react-app my-blog
&lt;span class="c"&gt;# these are pasted from `…or push an existing repository from the command line` section when new repo is created.&lt;/span&gt;
git remote add origin https://github.com/alanmynah/my-blog.git
git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>git</category>
      <category>github</category>
      <category>pr</category>
    </item>
    <item>
      <title>Remote vs office or the importance of having a choice.</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Fri, 12 Mar 2021 09:06:45 +0000</pubDate>
      <link>https://dev.to/alanmynah/remote-vs-office-or-the-importance-of-having-a-choice-103n</link>
      <guid>https://dev.to/alanmynah/remote-vs-office-or-the-importance-of-having-a-choice-103n</guid>
      <description>&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@visuals?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;visuals&lt;/a&gt; on &lt;a href="/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I started following my take on &lt;a href="https://www.swyx.io/three-strikes/"&gt;three strikes rules&lt;/a&gt;, where if I want to rant about something for 3 consecutive times, I need to sit down and have a cool-headed think about why it winds me up so much.&lt;/p&gt;

&lt;p&gt;Remote vs office has been on my mind way more than 3 times. But really what prompted this post is that someone I work with said (words to that effect, this is off my memory here): "I like and want to work from the office, but I'm made to feel as if it's something bad." And you know what? Despite me not sharing the desire for office work, I sympathise with the sentiment that no one should feel bad for having a preference.&lt;/p&gt;

&lt;h2&gt;
  
  
  I know where this is going
&lt;/h2&gt;

&lt;p&gt;Before you jump to any conclusions, yes, I love working remotely and I hope we (those of us who want) continue. But when we have a chance to reopen, we should not go back to the mirror image of what we had before the pandemic.&lt;/p&gt;

&lt;p&gt;Just imagine. Working from the office one day a week is a massive perk. You are allowed to get it after probation and it would involve a contractual change 😛. Those who wish to work from offices on a more permanent basis, say 2-4 days a week, are essentially forced to haggle and sacrifice some of their salary for the privilege. Yep, the reverse was a real story, I once heard a dev from Cambridge tell me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where is a downvote button here?
&lt;/h2&gt;

&lt;p&gt;I can see where the anger towards 'going back' is coming from. I really do. &lt;a href="https://www.bbc.co.uk/news/uk-53942542"&gt;From encouragement&lt;/a&gt; by the gov't, to pretty much &lt;a href="https://www.bbc.co.uk/news/uk-53942542"&gt;a property developer fessing up that they'd lose a tonne of money if we don't&lt;/a&gt;, but covering their primary motive up with concerns about 'fatigue' and convenience of doing "life's admin". As if people can't do it at the local high street. Unless you live at Canary Wharf, in which case my commiserations. There are very few places that I'd compare in soullessness to concrete barracks of my native Dnipropetrovsk, but there you are.&lt;/p&gt;

&lt;p&gt;People are also fatigued for a multitude of reasons that have pretty much everything to do with the pandemic and &lt;strong&gt;not having a choice&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Are there benefits to working from home?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  No commute? Saving HOURS daily? Yep.&lt;/li&gt;
&lt;li&gt;  Easier to focus? Aha.&lt;/li&gt;
&lt;li&gt;  More and hopefully better sleep? 💯&lt;/li&gt;
&lt;li&gt;  Saving some cash on petrol, insurance, train tickets? Oh yes!&lt;/li&gt;
&lt;li&gt;  Supporting local trade not just at the weekend? Hey, no prizes for guessing where I will be buying my coffee when the local places finally open up.&lt;/li&gt;
&lt;li&gt;  Saving some money on not eating out during work lunches? Erm, sure, but not after things open again 😆&lt;/li&gt;
&lt;li&gt;  Climate change? Yeah, I hope so anyway. Yes, yes, I know, I heat my house too, but I don't have 5m tall ceilings, and it's much easier to control one room in the house, instead of an open-plan office. But if you live in a converted church, scratch that one out.&lt;/li&gt;
&lt;li&gt;  Seeing your kids and family more? Definitely! Some of you must have this funny smile on your face, thinking "I bet he doesn't have kids after reading that" and you would be 100% right, Sherlock. But think about it, they'd have been at school now while you're reading this; your home office filled with silence. And during holidays you'd have been gone to someplace sunny or snowy, whichever you prefer. But you can't. See, that 'no choice' thing again?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  We were told it's not possible
&lt;/h2&gt;

&lt;p&gt;So all these people that are like me that love working from home are somewhat anxious that this might not last. Previously we were told that "we need to have a discussion and kick off trials", "we're not sure how productivity might be affected" (this one deserves a separate rant, but not 3 strikes yet), and "it would require some investment into home setups and we don't have a budget for that yet (aka, will never have, 😉-😉)" and then BAM! over the next couple of days and some painful MS Teams installs later, it's now come to life. Although, let's be honest, for most, we just brought our laptop home. Soooo it is possible and judging by the emails I received and had some forwarded to me, everyone's CEOs are telling us what a great job we did! 🥳🎉🎊&lt;/p&gt;

&lt;p&gt;Yes, yes, ok, some places were pretty strict with confidential information policies and static IP access to production, possibly some dev infrastructure hosted in-house with access only over the local network. Now as I've caveated the 'well-actually' 1%, how many of you from the 99% were told straight up "we have an easy choice between office or remote, do as you please"? Some of us were in a truly bizarre situation, where you had to come to the office to work closely with a remote team in a different timezone! But WFH was a perk...&lt;/p&gt;

&lt;h2&gt;
  
  
  No better problems to write about?
&lt;/h2&gt;

&lt;p&gt;What was that? Did I just hear "really, aren't there bigger problems in the world?" Ok, glad to have the relativists in the room too! Absolutely there are. Which one of the problems of the world do you care about the most? Oh, that's an important one, sure, we definitely need to do something about it. Hey, I can relate. We can focus on problems that we think we can do something about. And mine is to convince people to be more considerate when creating reformed workplaces.&lt;/p&gt;

&lt;p&gt;During any of the remote vs office conversations, I keep remembering this graffiti, which is rather applicable to a lot of conversations in general, but this one in particular.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N4yJyWnp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://firebasestorage.googleapis.com/v0/b/firescript-577a2.appspot.com/o/imgs%252Fapp%252Falanmynah%252F57_6dFqAl2.png%3Falt%3Dmedia%26token%3D86c833e0-fd5d-4469-884b-56f5acedcdb9" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N4yJyWnp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://firebasestorage.googleapis.com/v0/b/firescript-577a2.appspot.com/o/imgs%252Fapp%252Falanmynah%252F57_6dFqAl2.png%3Falt%3Dmedia%26token%3D86c833e0-fd5d-4469-884b-56f5acedcdb9" alt="A tweet of a picture of a graffiti, allegedly written during Hong Kong protests, that was translated as: &amp;quot;We can't return to normal, because the normal that we had was precisely the problem.&amp;quot;"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So yeah, remote defenders, I get your point. See? I'm your man, I feel you and share your concerns. Due to a really strange set of circumstances we've got what we were always told is difficult or impossible to get. It appeared to be relatively easy too. And that left a bitter aftertaste in some of us. &lt;strong&gt;We didn't have a choice&lt;/strong&gt;. Now the tables have turned and it &lt;strong&gt;feels&lt;/strong&gt; like someone wants to take it away, back to what it was before.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do you want then?
&lt;/h2&gt;

&lt;p&gt;Moving forward, do we really want to be &lt;strong&gt;denying the choice&lt;/strong&gt; to people who we work with?&lt;/p&gt;

&lt;p&gt;Some of your co-workers LOVE to be in the office. Just as they were oblivious to how much you want to work from home, we were oblivious to how much they actually enjoy the office. It had downsides, but it was their preferred status quo. Why bang on about how much they love it?&lt;/p&gt;

&lt;p&gt;Any perks to the office?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Personal conversations&lt;/li&gt;
&lt;li&gt;  Getting to know people a bit better&lt;/li&gt;
&lt;li&gt;  Listening to all the amazing books, and podcasts, and all the music on your commute?&lt;/li&gt;
&lt;li&gt;  Easier meetings (double-edged sword)&lt;/li&gt;
&lt;li&gt;  Getting together with them to celebrate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And I know, I know, you like some of these too and the pandemic prevented you from seeing relatives and loved ones. You too want to catch up with people, but just don't value what the office has to offer over WFH. And that's ok!&lt;/p&gt;

&lt;p&gt;Someone once said: "This pandemic has flipped the world, where extroverts were able to finally see how excruciating it must have been to introverts."&lt;/p&gt;

&lt;p&gt;Drawing parallels, do we 'remotists' really want to torture 'officers'?&lt;/p&gt;

&lt;p&gt;The future is distributed and it's really for your company to figure out how often all of you get together. Yes, ok, in our tribe, attitudes to Christmas parties range from 'hate them' to 'can barely stand them'. But hey, we can all remember some great stories, so getting together is ok, sometimes.&lt;/p&gt;

&lt;p&gt;We &lt;strong&gt;must&lt;/strong&gt; promote and advocate for the ability of our fellow co-workers to come to the office whenever they want or please. Just not drag us along.&lt;/p&gt;

&lt;h2&gt;
  
  
  We need to be able to have a choice
&lt;/h2&gt;

&lt;p&gt;We all &lt;strong&gt;want to have a choice&lt;/strong&gt;. Regardless of what the news outlets, property developers, or even your boss think.&lt;/p&gt;

&lt;p&gt;Make your views known, your company should know where everyone stands. Don't send that thrashing tweet about how blissful and perfect WFH is and that heretics should be disavowed from WFH paradise. Simply don't be an arse, your co-workers will thank you. And hopefully, &lt;strong&gt;they will stand your corner for your ability to have a choice&lt;/strong&gt; when your company thinks about getting you a season ticket loan again.&lt;/p&gt;

</description>
      <category>home</category>
      <category>office</category>
      <category>wfh</category>
    </item>
    <item>
      <title>Top 3 programming languages to learn in 2021.</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Thu, 31 Dec 2020 13:03:31 +0000</pubDate>
      <link>https://dev.to/alanmynah/top-3-programming-languages-to-learn-in-2021-3248</link>
      <guid>https://dev.to/alanmynah/top-3-programming-languages-to-learn-in-2021-3248</guid>
      <description>&lt;h2&gt;
  
  
  &lt;code&gt;JavaScript&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;More like "still everywhere". &lt;a href="https://alanmynah.com/blog/best-programming-languages-2018"&gt;I said so 3 years ago&lt;/a&gt; and it was already common knowledge, now even more people know about it. "The Sun rises in the East" type of statement. Some were happy, some were not, but now JS has evolved, TypeScript got more popular, we got Deno, the march goes on, and so the language is still the lingua franca of programming: mobile, web, backend, desktop apps, ML/AI, you name it, you can probably create it with JS.&lt;/p&gt;

&lt;p&gt;Learning materials have become even better than they were, so compared to other programming languages, ease of learning, and finding help, JS is still firmly at the top spot. Content creators have stepped up their game and introduced new courses. There is soooo much high-quality material for free on YouTube and paid content is out of this world.&lt;/p&gt;

&lt;p&gt;Closest to my heart would be &lt;a href="https://scrimba.com/learn/frontend?utm_source=alanmynah.com&amp;amp;utm_medium=referral&amp;amp;utm_campaign=top3-prog-lang-2021"&gt;Scrimba's Frontend Developer Career Path&lt;/a&gt;. Simply because of how comprehensive the content is and it can easily be the core stop to get a job. The Discord community is great and it's amazing seeing how people learn and get their first jobs in the industry. I loved being involved in curating materials with my wife for the career-path, reviewing courses, and helping out the core team. &lt;code&gt;&amp;lt;/humble-brag&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What more can I say? If you're not sure what interests you most, your friends or the web hasn't sold you on anything in particular, definitely learn JS. It's a win-win bet.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;C#&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Ok, I am biased here too. C# is what I write in my daily job. So no surprises, of course, I'd recommend people learn it. The learning curve is a bit steeper, it needs some initial setup, but it just jumped ahead in the last 3 years. With the latest .NET 5, you can write code with almost no boilerplate and you can use C# everywhere: mobile, backend, frontend, ML/AI, cloud apps, desktop apps. And if with JS you kinda know that you can create all of it, with C# you've got a guarantee from Microsoft that you can.&lt;/p&gt;

&lt;p&gt;For newcomers, it might be tricky to get familiar with .NET ecosystem as it's a very curious mix of old and new, but &lt;a href="https://www.hanselman.com/blog/what-is-net-how-does-it-work-is-it-a-language-or-a-platform"&gt;Scott Hanselman has a really nice video to clarify everything&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One of the JS's downsides is that things move too fast and the ecosystem is volatile, C# is the opposite. You can very safely build something and forget about it for decades, which is why if you want to get a job at a bank, but Java makes you sick - C# is your go-to.&lt;/p&gt;

&lt;p&gt;The demand is for C# devs is high and it's pretty pleasant to work with.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;Elixir&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Ok, so I hope this pick caught you by surprise. Elixir is definitely gaining a lot of popularity and it's 100% deserved. Why? Possibly because it's the most useful from the easiest to learn functional languages; or maybe because functional programming (FP) is trendy and hype and Elixir is a pleasure to learn; or maybe because most Ruby devs now switch to Elixir in droves (creator of Elixir used to be a Ruby on Rails dev).&lt;/p&gt;

&lt;p&gt;Think of it as FP's Python or Ruby - friendly and helpful, won't bite your hand off if you make a mistake - error messages in Elixir are just heavenly and very helpful; "Let it crash" attitude is not novel, but definitely rare in the industry; the docs are amazing and learning it as a 2nd, 3rd and so on language just feels familiar.&lt;/p&gt;

&lt;p&gt;Elixir runs on ErlangVM and has an astonishing foundation. I will leave the amazing reasons why you should learn it to someone who's got production experience in it, &lt;a href="https://www.erlang-solutions.com/blog/why-elixir-is-the-programming-language-you-should-learn-in-2020.html#:~:text=Learning%20Elixir%20can%20make%20you,in%20their%20language%20of%20choice."&gt;taken from here&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Is fun and easy to use&lt;/li&gt;
&lt;li&gt;  Has the ability to meet modern user demands&lt;/li&gt;
&lt;li&gt;  Has a rewarding career progression&lt;/li&gt;
&lt;li&gt;  Has an active and supportive community&lt;/li&gt;
&lt;li&gt;  Has a range of helpful tooling&lt;/li&gt;
&lt;li&gt;  Has frameworks to allow full-stack development&lt;/li&gt;
&lt;li&gt;  Has easily accessible documentation&lt;/li&gt;
&lt;li&gt;  Ensures you grow as a programmer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Elixir has a surprising level of maturity to its ecosystem, and feels 29 years old and not 9. Built-in best practices will ensure that even if you're starting your programming journey with Elixir you will not regret your choice.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>csharp</category>
      <category>elixir</category>
    </item>
    <item>
      <title>5 Whys, how to use it correctly?</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Tue, 29 Dec 2020 18:41:11 +0000</pubDate>
      <link>https://dev.to/alanmynah/5-whys-how-to-use-it-correctly-4ab6</link>
      <guid>https://dev.to/alanmynah/5-whys-how-to-use-it-correctly-4ab6</guid>
      <description>&lt;p&gt;&lt;span&gt;Photo by &lt;a href="https://unsplash.com/@birminghammuseumstrust?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Birmingham Museums Trust&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/car-factory?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;This article is most definitely going to be a part of a larger series on how we, software engineers, are misusing manufacturing practices, techniques and tools, and then complain that they are broken, unfit for purpose, or just wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL; DR
&lt;/h2&gt;

&lt;p&gt;The 5 whys in the original sense is an effective technique that should most definitely be used. Any shortly named heuristic that is then explained in 1-2 sentences is most likely going to miss the most fundamental reasons for its existence. Please don't use it to solve complex problems, but do apply it to finding problems in your CI/CD pipeline or finding some simple bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why 5 Whys don't work
&lt;/h2&gt;

&lt;p&gt;As &lt;strong&gt;&lt;em&gt;THE&lt;/em&gt;&lt;/strong&gt; tool for root cause analysis, 5 Whys is a rather discredited technique. Many very good articles and overviews have been written. &lt;a href="https://www.kitchensoap.com/2012/02/10/each-necessary-but-only-jointly-sufficient/"&gt;This one by John Allspaw&lt;/a&gt;, at least in my twitterverse, is quoted most; and sums it best with:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;for complex systems: there is no root cause.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Props also go to Mark Mulvey for writing one of the really &lt;a href="https://weeklysurf.substack.com/p/trouble-with-root-causes"&gt;succinct breakdowns of the problem with 5 Whys&lt;/a&gt;. That was in turn inspired by 5 Whys topping Swyx's list of &lt;a href="https://www.swyx.io/naked-emperors/"&gt;Naked emperors in Tech&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But the cherry on top is placed by Teruyuki Minoura, Toyota's own former managing director of global purchasing, &lt;a href="https://en.wikipedia.org/wiki/Five_whys#Criticism"&gt;who described 5 Whys&lt;/a&gt; as being&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;too basic a tool to analyze root causes to the depth that is needed to ensure that they are fixed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why the criticism is misdirected
&lt;/h2&gt;

&lt;p&gt;Because it's a straightforward simple tool, that is good &lt;em&gt;only&lt;/em&gt; for a small set of simple causes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complex systems are not within the scope of this tool.&lt;/strong&gt; It's just &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt; tool for root cause analysis (RCA), and a simple one at that, for the exact reasons described in the section above.&lt;/p&gt;

&lt;p&gt;Just to be clear, all these criticisms are valid, but it really should be directed towards how 5 Whys is 'marketed' or more importantly, interpreted. Seriously, google it to see what I mean. The first hit will come from Mind Tools &lt;a href="https://www.mindtools.com/pages/article/newTMC_5W.htm"&gt;article&lt;/a&gt; that describes it as&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The method is remarkably simple: when a problem occurs, you drill down to its root cause by asking "Why?" five times.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This simple technique, however, can often direct you quickly to the root cause of a problem.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Even worse, AWS's &lt;a href="https://wa.aws.amazon.com/wat.concept.rca.en.html"&gt;Root Cause Analysis (RCA) page&lt;/a&gt; simply states&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Identify Root Causes: Use Five whys and Ishikawa diagrams&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Origins and present day
&lt;/h2&gt;

&lt;p&gt;The birthplace of the technique is somewhere on the Toyota's shop floor, but it really took off after Taiichi Ohno, the father of Toyota Production System (TPS) wrote his book titled &lt;code&gt;TPS. Beyond Large-Scale Production&lt;/code&gt;. He mentioned the technique &lt;em&gt;once&lt;/em&gt;. Yep, didn't dedicate chapters to it and didn't even bother to warn anyone of misusing it. And based on Minoura's thoughts on the matter, I can guarantee, there was a lot of it even at Toyota.&lt;/p&gt;

&lt;p&gt;Simple sounding techniques have a tendency to turn into holy wars about their true meaning (looking at you TDD and OOP).&lt;/p&gt;

&lt;p&gt;Anyway, back to Taiichi Ohno's passage:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Repeating why five times, [...], can help uncover the root problem and correct it. If this procedure were not carried through, one might simply replace the fuse or the pump shaft. In that case, the problem would recur within a few months.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Note, that the focus is on questioning the fault, rather than ignoring it. It's a guidance for manufacturing processes at an assembly line. Production is moving and ignoring a problem might never have any repercussions for you as a worker, while raising alarm risks a lot of delays and oftentimes jeopardizes your throughput dependant income too.&lt;/p&gt;

&lt;p&gt;Ohno then goes to say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To tell the truth, the Toyota production system has been built on the practice and evolution of this scientific approach. By asking why five times and answering it each time, we can get to the real cause of the problem, which is often hidden behind more obvious symptoms.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So "dig deeper, don't stop at the first opportunity.", got it. And he then finishes with:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In a production plant operation, data are highly regarded - but I consider facts to be even more important. When a problem arises, if our search for the cause is not thorough, the actions taken can be out of focus. This is why we repeatedly ask why. This is the scientific basis of the Toyota system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's it. It appears that his understanding of 5 Whys is that it's just a shorthand for 'be scientific in your approach to problem-solving'. He does not mention the technique in his book anymore. Why? Because it's insignificant compared to the much more important, structural, and cultural techniques in TPS, like &lt;a href="https://blog.toyota.co.uk/jidoka-toyota-production-system"&gt;Jidoka&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is it good for then?
&lt;/h2&gt;

&lt;p&gt;It's a useful rule of thumb, to avoid sweeping problems under the rug. Flaky tests? Why? Flaky pipeline? Why?&lt;/p&gt;

&lt;p&gt;It is a way to try to get to a set of countermeasures to prevent the defect OR be able to spot the defect so early as to absolutely minimize the cost (material, time, and other) of the defect to the manufacturing process.&lt;/p&gt;

&lt;p&gt;And don't get hung up on the magic number 5. I bet it was called like that because, in Japanese, it sounded better than 4 whys or 7 whys  - a surprisingly common reason to do a lot of things in manufacturing.&lt;/p&gt;

&lt;p&gt;Finding why you get that &lt;code&gt;undefined&lt;/code&gt; error (Well, in about 50% of cases 😜), why CI failed, and even throw some API error codes at 5 Whys and it will help you out. Other than that, just use the technique to get yourself started and pick up something more advanced.&lt;/p&gt;

&lt;h2&gt;
  
  
  The alternatives
&lt;/h2&gt;

&lt;p&gt;There isn't a single technique that would work universally, but here are some that might help you (Yes, 5 Whys is one of them, so skipping it):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.6sigma.us/etc/what-is-ishikawa-fishbone-diagram/"&gt;Ishikawa Fishbone diagram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.isixsigma.com/dictionary/current-reality-tree/"&gt;Current Reality Tree (CRT)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://asq.org/quality-resources/eight-disciplines-8d"&gt;The 8 Disciplines (8D)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.six-sigma-material.com/Correlation-Matrix.html"&gt;Correlation Matrix&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.six-sigma-material.com/FMEA.html"&gt;Failure Mode and Effects Analysis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/alanmynah/alanmynahdotcom/blob/main/src/routes/blog/posts/5-whys.md"&gt;Feel free to PR this article&lt;/a&gt; with your favourite one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing thoughts
&lt;/h2&gt;

&lt;p&gt;IMO, these misunderstandings stem from our (those working in the software industry) inability to transfer context. Manufacturing is geared towards repeatable, quantifiable, plannable processes. Software development, more often than not, isn't. Applying solutions to the wrong context produces unexpected results.&lt;/p&gt;

&lt;p&gt;One thing you can take away from this article is this sassy quote for your internal slack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tired: 5 whys is rubbish and 'in complex systems, there is no root cause'

Wired: let's expand the RCA docs with more advanced 6-sigma techniques.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>5whys</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is an API? Explained in plain English</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Mon, 02 Nov 2020 17:41:54 +0000</pubDate>
      <link>https://dev.to/alanmynah/what-is-an-api-3pkd</link>
      <guid>https://dev.to/alanmynah/what-is-an-api-3pkd</guid>
      <description>&lt;p&gt;&lt;span&gt;Photo by &lt;a href="https://unsplash.com/@k8townsend?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Kate Townsend&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/venice-waiter?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What exactly is an API?
&lt;/h2&gt;

&lt;p&gt;Any aspiring developer, product(project) manager new to the software industry, eventually gets hit with the term &lt;code&gt;API&lt;/code&gt; and when questioned about the exact meaning of this acronym, encounters a lot of hand-waving and generic statements. Add all sorts of metaphors about waiters, beers (possibly because it makes people think of IPA), and waiters bringing your unwilling teacher's favourite beverages.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;API&lt;/code&gt; stands for - &lt;strong&gt;A&lt;/strong&gt;pplication &lt;strong&gt;P&lt;/strong&gt;rogramming &lt;strong&gt;I&lt;/strong&gt;nterface&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Officially, &lt;code&gt;API&lt;/code&gt; stands for - &lt;strong&gt;A&lt;/strong&gt;pplication &lt;strong&gt;P&lt;/strong&gt;rogramming &lt;strong&gt;I&lt;/strong&gt;nterface, but that doesn't clarify anything, does it? Otherwise, you wouldn't be reading this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start from &lt;code&gt;UI&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Let's start from some solid ground. When you go to any website, you see a collection of buttons, links, dropdowns, text fields, and date pickers. As a whole, it is a way for us, users, to interact with the system.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;U&lt;/strong&gt;ser &lt;strong&gt;I&lt;/strong&gt;nterfaces are for us, users, to interact with systems.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We say it's a &lt;strong&gt;U&lt;/strong&gt;ser &lt;strong&gt;I&lt;/strong&gt;nterface. Netflix has one, when you go to watch a film on your laptop, you use a keyboard and a mouse to interact with the &lt;code&gt;UI&lt;/code&gt;. On your TV, it's a clunky remote. And on your phone, you use your fingers to tap on the screen.&lt;/p&gt;

&lt;p&gt;Some cars have stereos that get operated with knobs and buttons and more modern versions have touchscreens. All of these are &lt;strong&gt;U&lt;/strong&gt;ser &lt;strong&gt;I&lt;/strong&gt;nterfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;UI&lt;/code&gt; is a gateway into &lt;code&gt;API&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;API&lt;/code&gt;s are ways for us, developers, to interact with programs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;pplication &lt;strong&gt;P&lt;/strong&gt;rogramming &lt;strong&gt;I&lt;/strong&gt;nterfaces, are for us, developers, to interact with systems.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Users interact with &lt;code&gt;UI&lt;/code&gt;s that developers wrote by interacting with APIs that other (or same) developers created.&lt;/p&gt;

&lt;p&gt;Developers write programs that expose some interactive points for others to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why create API?
&lt;/h2&gt;

&lt;p&gt;I can sense a question: "Why to create a program to interact with another program that does what I want? Why not have one?"&lt;/p&gt;

&lt;p&gt;&lt;code&gt;UI&lt;/code&gt;s only care about creating a pretty, intuitive, and safe environment for your users to access the services you provide.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;API&lt;/code&gt;s only care about providing access to these services in a secure, consistent, and reasonably fast manner.&lt;/p&gt;

&lt;p&gt;Mixing the two is possible, but the industry found that &lt;a href="https://en.wikipedia.org/wiki/Separation_of_concerns#:~:text=In%20computer%20science%2C%20separation%20of,code%20of%20a%20computer%20program."&gt;separating concerns&lt;/a&gt; is a pretty good idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;API&lt;/code&gt; is simply a catch-all term for interaction points exposed by one program for developers to use to create their own.&lt;/p&gt;

&lt;p&gt;The reason for such monumental confusion is because the term 'API' is oftentimes used proverbially and sometimes as a replacement for words like 'system', 'services', 'backend', or your companies moniker, like 'the beast', 'monster', 'flake', etc.&lt;/p&gt;

&lt;p&gt;Hope this clears things up and if you've still got some questions, feel free to get in touch!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>programming</category>
    </item>
    <item>
      <title>Use Nobel Prize-winning Auction Theory to choose the right job offer</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Tue, 27 Oct 2020 18:27:38 +0000</pubDate>
      <link>https://dev.to/alanmynah/use-nobel-prize-winning-auction-theory-to-choose-the-right-job-offer-1mn5</link>
      <guid>https://dev.to/alanmynah/use-nobel-prize-winning-auction-theory-to-choose-the-right-job-offer-1mn5</guid>
      <description>&lt;h2&gt;
  
  
  Nobel Prize Idea
&lt;/h2&gt;

&lt;p&gt;So it recently did the rounds in the news -  Nobel Prize in Economics was awarded to Paul Milgrom and Robert Wilson for their work on auction theory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bbc.co.uk/news/business-54509051"&gt;Nobel: US auction theorists win Economics Prize - BBC News&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Auction Theory?
&lt;/h2&gt;

&lt;p&gt;Milgrom and Wilson’s research focused on “unknown common values” - the value of a thing or a resource is the same for everyone, but no one is quite sure how much it’s worth, because they don’t know how much they can make out of the resource. They found that when this is the case, bidders tend to bid low to avoid the winner’s curse (overpay for something worth much less). If everyone bids low, the seller is sad.&lt;/p&gt;

&lt;p&gt;Our friends, Milgrom and Wilson, thought of some formats that are designed to reduce the problem of “unknown common values”.&lt;/p&gt;

&lt;p&gt;For example, use multiple rounds, and between each round, information about all the bids is revealed, so everyone knows what’s everyone bidding, so no one is afraid they are overbidding. The next round has a minimum bid of a maximum bid from the previous round. This is repeated until there is a clear winner. The seller gets top dollar, and the winner knows that what they are getting is well-valued by the other market participants.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can devs use this for job offers?
&lt;/h2&gt;

&lt;p&gt;Do I think candidates can get over the initial awkwardness of the notion and ditch the current best practices?&lt;/p&gt;

&lt;p&gt;Maybe... Is anyone willing to start a spreadsheet with all their offers that they later email to everyone who offered them a job, until there is only one highest bidder?&lt;/p&gt;

&lt;p&gt;In reality, this isn't any different from what we're doing now, but on a smaller scale and with individually crafted emails.&lt;/p&gt;

&lt;p&gt;The negotiation phase of the offer is fraught with faux pas and one needs to be clued up on the matter to secure a decent package. I don’t even want to blame the companies for taking advantage of the inexperienced candidates, but it’s worth pointing out that it’s not uncommon to hear people complain that they were afraid to negotiate and as a result feel underpaid when they discover their peers’ pay rates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Objections
&lt;/h2&gt;

&lt;p&gt;Yes, compensation is complex, there is much more to it than just monetary reimbursement, but for this scenario please consider that the candidate evaluates the offer purely on £££ value, with all other things being equal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some notes and sources:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;“Ok, still not quite sure, can you please ELI5?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sure thing, here’s &lt;a href="https://www.reddit.com/r/explainlikeimfive/comments/j9w2ja/eli5_how_does_the_nobel_prize_winners_milgron_and"&gt;reddit's ELI5&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Sorry, I don’t really like reading, do you have a podcast link or something?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sure, here’s the BBC’s More or Less episode explanation&lt;br&gt;
&lt;a href="https://www.bbc.co.uk/programmes/p08vhzkl"&gt;BBC Radio 4 - More or Less: Behind the Stats, Auction Theory - Paul Milgrom and Robert Wilson&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“Yeah, I don’t think I still have enough info, can you give the source to a proper explanation?”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Straight from the horse’s mouth: &lt;a href="http://www.econ.ucla.edu/riley/271/Milgrom-Putting%20Auction%20Theory%20to%20Work.pdf"&gt;Paul Milgrom’s book on UCLA website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Would you try this?
&lt;/h2&gt;

&lt;p&gt;I really want to hear your thoughts! I did make a survey on LinkedIn and it &lt;em&gt;TANKED&lt;/em&gt;! Got 2 replies, so clearly not enough to be decisive. Please let me know what you think.&lt;/p&gt;




&lt;p&gt;Hey! Thanks for reading! Questions, suggestions, feedback? Reach out on Twitter &lt;a href="https://www.twitter.com/alanmynah"&gt;@alanmynah&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Photo by 🇨🇭 Claudio Schwarz | &lt;a href="https://unsplash.com/@purzlbaum"&gt;@purzlbaum&lt;/a&gt;&lt;/p&gt;

</description>
      <category>jobs</category>
      <category>offers</category>
      <category>negotiations</category>
    </item>
    <item>
      <title>Build an app to find your next meal with React Hooks</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Mon, 27 Apr 2020 19:24:03 +0000</pubDate>
      <link>https://dev.to/alanmynah/build-an-app-to-find-your-next-meal-with-react-hooks-2pj8</link>
      <guid>https://dev.to/alanmynah/build-an-app-to-find-your-next-meal-with-react-hooks-2pj8</guid>
      <description>&lt;h2&gt;
  
  
  A quick React Hooks tutorial to get you started
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will learn the basics of React hooks by building a recipe finder application.&lt;/p&gt;

&lt;p&gt;The premise is straightforward, a user can type an ingredient and get 10 recipes that use the ingredient. Nice and simple.&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s a hook?
&lt;/h3&gt;

&lt;p&gt;If you are rolling your eyes 🙄, skip to the next section! 😛&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://reactjs.org/docs/hooks-state.html#whats-a-hook"&gt;the official docs&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A Hook is a special function that lets you “hook into” React features.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;So in this post, we will learn &lt;code&gt;useState&lt;/code&gt;, &lt;code&gt;useEffect&lt;/code&gt; and how to create our own custom hooks. We will also cover how to fetch data from an API and some HTML-form management using hooks.&lt;/p&gt;

&lt;p&gt;But as for now, let me hook you up with some new React features.&lt;/p&gt;
&lt;h3&gt;
  
  
  What will you need?
&lt;/h3&gt;

&lt;p&gt;Maybe a tiny bit of JavaScript and some React knowledge about props, state and event handlers.&lt;/p&gt;

&lt;p&gt;If you are completely new to React, that’s no problem, I can wait for 5 minutes while you’re reading this great &lt;a href="https://medium.freecodecamp.org/learn-react-js-in-5-minutes-526472d292f4"&gt;5-minute intro to React&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;Not a huge fan of complicated setups. There are as many ways to set up React apps as there are React developers, so if you have a favourite setup, feel free to use it.&lt;/p&gt;

&lt;p&gt;For this tutorial, here’s an HTML file which imports React and ReactDOM libraries via CDN using &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Alternatively, you can also experiment with the code in this &lt;a href="https://scrimba.com/c/ckMbdafa"&gt;React Scrimba playground&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Our Hooks Application
&lt;/h2&gt;

&lt;p&gt;We are going to build a very simplified recipe finding app that we can use to start learning hooks. It will consist of a form with an input field and a submit button. We will fetch some recipes over &lt;a href="http://www.recipepuppy.com"&gt;Recipe Puppy API&lt;/a&gt; and display the results in an unordered list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SNpi3Ftu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2732/1%2AKqLdyv3KjPyu66nQXZeK_w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SNpi3Ftu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2732/1%2AKqLdyv3KjPyu66nQXZeK_w.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Find dinner ideas with Recipe Puppy API
&lt;/h2&gt;

&lt;p&gt;To get some flavoursome ideas and to find something tasty, we will use &lt;a href="http://www.recipepuppy.com"&gt;Recipe Puppy API&lt;/a&gt;. Inside the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag we have provided &lt;code&gt;getData()&lt;/code&gt; helper function to fetch the recipes from the API.&lt;/p&gt;

&lt;p&gt;For this tutorial, it’s best to think of it, like a slightly improved &lt;code&gt;fetch()&lt;/code&gt; function and we will use it in the same way.&lt;/p&gt;

&lt;p&gt;We didn’t really want to distract you from learning hooks, so we created this helper function do all the heavy lifting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read from an input field with useState hook
&lt;/h2&gt;

&lt;p&gt;Let’s create a barebones layout. So far, an emoji for fun and a &lt;code&gt;console.log&lt;/code&gt; as a tradition. Nothing overly complicated.&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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&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;(&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="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;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;Amazing Recipes&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
        &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Favourite food"&lt;/span&gt;
        &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;
      &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Find something tasty&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"img"&lt;/span&gt; &lt;span class="na"&gt;aria&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"avocado"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          🥑
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;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;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jg0wsskm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2332/1%2AaMw5U9fg9O2J7Bt6Ep0k2A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jg0wsskm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2332/1%2AaMw5U9fg9O2J7Bt6Ep0k2A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we would like to store the input value. If it were a class component, we would store data in this.state. Well, with hooks, we simply &lt;code&gt;useState()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;useState accepts initial state and always returns a pair of values: the current state, and a function that updates it.&lt;/p&gt;

&lt;p&gt;We can access the returned pair using array destructuring in the very beginning of our function body, like so:&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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&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;ingredients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&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;(&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="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;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;Amazing Recipes&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
        &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"type ingredients here"&lt;/span&gt;
        &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;
      &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Find something tasty&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"img"&lt;/span&gt; &lt;span class="na"&gt;aria&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"avocado"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          🥑
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;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;In the snippet above, &lt;code&gt;ingredients&lt;/code&gt; is initial value, we can use it as a value to display to our users.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;setIngredients&lt;/code&gt; is a state update function for ingredients and can be added to events, in our case that’s &lt;code&gt;onChange&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We pass an empty string &lt;code&gt;""&lt;/code&gt; as the initial value to &lt;code&gt;useState("")&lt;/code&gt;, as if we wanted to simply say &lt;code&gt;ingredients = ""&lt;/code&gt;&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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&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;ingredients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&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;(&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="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;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;Amazing Recipes&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
        &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"type ingredients here"&lt;/span&gt;
        &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Find something tasty&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"img"&lt;/span&gt; &lt;span class="na"&gt;aria&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"avocado"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          🥑
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;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;So on the first render of the app, it would look as if nothing changed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jg0wsskm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2332/1%2AaMw5U9fg9O2J7Bt6Ep0k2A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jg0wsskm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2332/1%2AaMw5U9fg9O2J7Bt6Ep0k2A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But if we type something into the input field we can see that our input gets updated as we type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b1Gb0qo2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2132/1%2AJ6F5hZ3fB963xjB0zjAaXw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b1Gb0qo2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2132/1%2AJ6F5hZ3fB963xjB0zjAaXw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Fetch data from an API with useEffect
&lt;/h2&gt;

&lt;p&gt;useEffect hook tells React that the component needs to do something after render. In our case, we want to get some recipes. To call the API, we will call &lt;code&gt;getData()&lt;/code&gt; helper function and for now, we will pass an empty string &lt;code&gt;""&lt;/code&gt; to it.&lt;/p&gt;

&lt;p&gt;We will also use another useState hook, to store our recipes.&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;recipes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setRecipes&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;

    &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;getData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;setRecipes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;results&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="o"&gt;*&lt;/span&gt;&lt;span class="c1"&gt;// &amp;lt;-- what's that? More on [] below*&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="c1"&gt;//...same JSX...&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Oops, we get a warning.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DPpYQAa4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4292/1%2AXENaP7xX2Aq5lkboR_NR1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DPpYQAa4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/4292/1%2AXENaP7xX2Aq5lkboR_NR1g.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Luckily, the warning contains the solution and a helpful link to learn more.&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;useEffect&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchRecipes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;getData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;setRecipes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;results&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="nx"&gt;fetchRecipes&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;You might have noticed an empty array &lt;code&gt;[]&lt;/code&gt; as a second argument to &lt;code&gt;useEffect&lt;/code&gt;. Why do we use it? &lt;code&gt;useEffect&lt;/code&gt; runs after every render. If we pass some value into the array, we will ask &lt;code&gt;useEffect&lt;/code&gt; to check if the value changed and apply the effect &lt;em&gt;only&lt;/em&gt; if that value changed. We will do so when we pass &lt;code&gt;[]&lt;/code&gt; we effectively say ‘Run &lt;code&gt;useEffect&lt;/code&gt; on every render.’&lt;/p&gt;

&lt;p&gt;Now, with the error gone, we can render out the recipes.&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="k"&gt;return&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;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;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;Amazing Recipes&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
      &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"type ingredients here"&lt;/span&gt;
      &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Find something tasty&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"img"&lt;/span&gt; &lt;span class="na"&gt;aria&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"avocado"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        🥑
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;ul&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;recipe&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;img&lt;/span&gt; &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;thumbnail&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt; &lt;span class="na"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"noopener noreferrer"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&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;a&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;))&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;ul&lt;/span&gt;&lt;span class="p"&gt;&amp;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="c1"&gt;// more on target="_blank" rel="noopener noreferrer"&lt;/span&gt;
&lt;span class="c1"&gt;// can be found here: [https://mathiasbynens.github.io/rel-noopener/](https://mathiasbynens.github.io/rel-noopener/)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--21MTaznP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2364/1%2A7IVmJg77JwPkgFlgaszkKg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--21MTaznP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2364/1%2A7IVmJg77JwPkgFlgaszkKg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can use a ternary expression to render a default image if there is no thumbnail image provided by the API.&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;ul&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;recipe&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;thumbnail&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;img&lt;/span&gt; &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;thumbnail&lt;/span&gt;&lt;span class="si"&gt;}&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="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;img&lt;/span&gt;
          &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"default-meal"&lt;/span&gt;
          &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"[http://i65.tinypic.com/maateu.png](http://i65.tinypic.com/maateu.png)"&lt;/span&gt;
        &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;)&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;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt; &lt;span class="na"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"noopener noreferrer"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&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;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;))&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;ul&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Trigger a hook manually to fetch data
&lt;/h2&gt;

&lt;p&gt;A good way of triggering a manual fetch would be with a form element. A form also makes it possible to trigger the button with “Enter” on the keyboard, which is a nice bonus.&lt;/p&gt;

&lt;p&gt;Let’s write &lt;code&gt;doFetch()&lt;/code&gt;. It will receive search parameters that &lt;code&gt;getData()&lt;/code&gt; requires to call RecipePuppy API.&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;recipes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setRecipes&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&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;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setSearch&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;useEffect&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;getData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;setRecipes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;results&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;};&lt;/span&gt;
      &lt;span class="nx"&gt;fetchRecipes&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;search&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;doFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;query&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;setSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;query&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;Let’s now wrap our input and button in &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; and pass to &lt;code&gt;onSubmit()&lt;/code&gt; event our &lt;code&gt;doFetch()&lt;/code&gt; function, passing ingredients to it.&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;
  &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&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;doFetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// To prevent browser reloads when clicking the submit button&lt;/span&gt;
    &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;&amp;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;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"type ingredients here"&lt;/span&gt;
    &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ingredients&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Find something tasty&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Great, now it all works!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2J0tUYu8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2392/1%2APwvOKXzW24j9tP2CY9bbsA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2J0tUYu8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2392/1%2APwvOKXzW24j9tP2CY9bbsA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s the app done and let’s have a small refactor.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a custom hook
&lt;/h2&gt;

&lt;p&gt;We can create our own hooks, by combining hooks that React gives us.&lt;/p&gt;

&lt;p&gt;Let’s create our own hook by extracting search and recipes state hooks and &lt;code&gt;doFetch()&lt;/code&gt;. We can also specify what a custom hook returns, by returning an object with variables and functions.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;useRecipePuppyApi&lt;/span&gt; &lt;span class="o"&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;recipes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setRecipes&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&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;search&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setSearch&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;useEffect&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchRecipes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;getData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;setRecipes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;results&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="nx"&gt;fetchRecipes&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;search&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;doFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;query&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;setSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;query&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;{&lt;/span&gt; &lt;span class="nx"&gt;recipes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;doFetch&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;Inside of our &lt;code&gt;App&lt;/code&gt; component we do not need to change any JSX, as all that code needs are just recipes and doFetch.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;useRecipePuppyApi&lt;/span&gt; &lt;span class="o"&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="c1"&gt;// ...custom hook logic...&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&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;ingredients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIngredients&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;recipes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;doFetch&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRecipePuppyApi&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="c1"&gt;// ...JSX is the same...&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;Now, this component is so nice and simple to read. It’s two hooks and JSX.&lt;/p&gt;

&lt;p&gt;Congratulations. You now know the very fundamental hooks and even more importantly you also know how to create your own!&lt;/p&gt;
&lt;h2&gt;
  
  
  Full code
&lt;/h2&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;h2&gt;
  
  
  Continue learning React
&lt;/h2&gt;

&lt;p&gt;I hope you’re hooked (yep, of course, there must be a pun), and you want to learn more, be sure to check out &lt;a href="https://scrimba.com/g/glearnreact"&gt;free React course on Scrimba.&lt;/a&gt; as I learnt most of this from there.&lt;/p&gt;

</description>
      <category>react</category>
      <category>reacthooks</category>
      <category>javascript</category>
      <category>5minutetutorials</category>
    </item>
    <item>
      <title>Create a neat RSVP card with pure CSS.</title>
      <dc:creator>alanmynah</dc:creator>
      <pubDate>Fri, 23 Aug 2019 18:59:22 +0000</pubDate>
      <link>https://dev.to/alanmynah/create-a-neat-rsvp-card-with-pure-css-4fg1</link>
      <guid>https://dev.to/alanmynah/create-a-neat-rsvp-card-with-pure-css-4fg1</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%2F2twcm93y5nw196fdbkc2.gif" 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%2F2twcm93y5nw196fdbkc2.gif" alt="GIF of RSVP card"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've been one of the lucky few who had a preview of &lt;a href="https://twitter.com/KevinJPowell" rel="noopener noreferrer"&gt;@KevinJPowell&lt;/a&gt;'s &lt;a href="https://scrimba.com/g/gresponsive" rel="noopener noreferrer"&gt;responsive web developer bootcamp on Scrimba&lt;/a&gt;. I cannot recommend it highly enough, as watching the course helped me immensely in writing this post!&lt;/p&gt;

&lt;p&gt;With this post, you will learn how to create an RSVP card, with just CSS and HTML, for any occasion!&lt;/p&gt;

&lt;p&gt;Also, I have to admit that I've been a massive Scrimba fan for a very long time and always keep telling everyone I meet at every meetup how great it is! &lt;/p&gt;

&lt;p&gt;Naturally, if you fancy playing with my code, &lt;a href="https://scrimba.com/c/cR4b8JuQ" rel="noopener noreferrer"&gt;there is a playground&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If English is not your native language, like me, and you have never encountered RSVP cards before, RSVP is French for &lt;em&gt;Répondez s'il vous plaît&lt;/em&gt;, meaning "Please respond" and is used widely in the UK, US, Canada, etc. as invitations to weddings and other formal occasions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Start with simple HTML
&lt;/h1&gt;

&lt;p&gt;Let's start with HTML representation of the card and have separate &lt;code&gt;div&lt;/code&gt;s for card's front and back.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &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;"index.css"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&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;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"front"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Front&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&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;"back"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Back&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&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%2Fwuxsasguli1hmnb6yy8v.png" 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%2Fwuxsasguli1hmnb6yy8v.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's now add some basic CSS to prepare a container for where the card is going to be. We can use relative % units to make sure that everything is centred.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#b6d4df&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-50%&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;&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%2Fo9y2dqpexebpjui2aef9.png" 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%2Fo9y2dqpexebpjui2aef9.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's now add the card.&lt;/p&gt;

&lt;p&gt;Percentage values are that of the parent container. So when we use width and height of 100% on &lt;code&gt;.card&lt;/code&gt; class, it will take the same size as &lt;code&gt;.container&lt;/code&gt; class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#b6d4df&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&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 we can now also add styles for each face of the card.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.front&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nc"&gt;.back&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&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="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fafafa&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#333&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;&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%2Fytcfwuepzgk5q5r7l9zb.png" 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%2Fytcfwuepzgk5q5r7l9zb.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well, the card is there, but we see the back of it. That's because &lt;code&gt;back&lt;/code&gt; is rendered later, so it's covering &lt;code&gt;front&lt;/code&gt;. To show &lt;code&gt;front&lt;/code&gt;, I need to add &lt;code&gt;backface-visibility: hidden;&lt;/code&gt; to both sides and now just need to rotate it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.front&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nc"&gt;.back&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* the rest of CSS */&lt;/span&gt;
  &lt;span class="nl"&gt;backface-visibility&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.back&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;180deg&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;&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%2F39r4t7sma2n7filbsah0.png" 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%2F39r4t7sma2n7filbsah0.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's much better. Let's try to make it flip around when we hover over the card.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.card&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;180deg&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;&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%2Fbqarrh9q35gldeujkkb1.png" 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%2Fbqarrh9q35gldeujkkb1.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're getting there, but it's not what we quite wanted. The magic CSS line to flip the card is &lt;code&gt;transform-style: preserve-3d;&lt;/code&gt;. I'm also going to add &lt;code&gt;transition: all 0.8s ease;&lt;/code&gt; to &lt;code&gt;.card&lt;/code&gt; to make the animation transition look more natural.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.card&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform-style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;preserve-3d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="m"&gt;0.8s&lt;/span&gt; &lt;span class="n"&gt;ease&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;o give the transition a slightly more polished look, let's add &lt;code&gt;perspective: 1000px;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;perspective&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1000px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-50%&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;&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%2F8zshrdpu43tcbyukxzai.gif" 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%2F8zshrdpu43tcbyukxzai.gif" alt="GIF of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's spruce up the wording, to make this design as close to real-life as we can, so you can reuse it for your own party!&lt;/p&gt;

&lt;p&gt;And I'll add some fonts, while we're here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &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;"index.css"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
      &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.googleapis.com/css?family=Tangerine&amp;amp;display=swap"&lt;/span&gt;
      &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
      &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.googleapis.com/css?family=Playfair+Display&amp;amp;display=swap"&lt;/span&gt;
      &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&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;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&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;"front"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Your Invitation to Celebrate With Us&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Please turn the card to reply&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&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;"back"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;RSVP&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;We would be thrilled for you to celebrate with us.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;button&amp;gt;&lt;/span&gt;Yes, I'd love to come&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;button&amp;gt;&lt;/span&gt;Unfortunately, I'm busy&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&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%2Fzpq93wjv9iph4ec2fqoi.png" 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%2Fzpq93wjv9iph4ec2fqoi.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;br&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%2Fdfm96dt0fd2zofdraj77.png" 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%2Fdfm96dt0fd2zofdraj77.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Responsive typography
&lt;/h1&gt;

&lt;p&gt;Having good effects is nice, but if the text looks bland, the card just won't cut it.&lt;/p&gt;

&lt;p&gt;Normally, there are two most common issues with CSS. Being able to react to changing requirements with minimum changes and maintaining &lt;code&gt;px&lt;/code&gt; values everywhere. :D&lt;/p&gt;

&lt;p&gt;This is when &lt;code&gt;rem&lt;/code&gt; comes to the rescue.&lt;/p&gt;

&lt;p&gt;A rem is the font-size value to your root element, i.e &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; element.&lt;/p&gt;

&lt;p&gt;By default, it's not written, but it's as if:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;html&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16px&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;That means that when we set &lt;code&gt;font-size: 1rem;&lt;/code&gt; it's the same as &lt;code&gt;font-size: 16px;&lt;/code&gt;. So if we want to scale things out, we change one value and everything follows suit.&lt;/p&gt;

&lt;p&gt;Let's see what that would look like with our card.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'Tangerine'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;cursive&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.8rem&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;span class="nc"&gt;.front&lt;/span&gt; &lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.back&lt;/span&gt; &lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'Playfair Display'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.8rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;normal&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;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.75rem&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;&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%2F2z0tu5bbhyqqa04ss3kk.png" 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%2F2z0tu5bbhyqqa04ss3kk.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;br&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%2Fs8rw5h9bodltsbpxyg4v.png" 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%2Fs8rw5h9bodltsbpxyg4v.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A nice touch would be to add some colour to the button when it's hovered over.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;lightgray&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;&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%2F2twcm93y5nw196fdbkc2.gif" 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%2F2twcm93y5nw196fdbkc2.gif" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But hey, when the window is resized, it destroys the look of the card. Doesn't look that great.&lt;/p&gt;

&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%2Fi2yrz9xshlkz9tfar3sx.png" 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%2Fi2yrz9xshlkz9tfar3sx.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&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%2F9vn4szoe3b98jaz26lpd.png" 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%2F9vn4szoe3b98jaz26lpd.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To fix it, we can use &lt;code&gt;min-&lt;/code&gt; &lt;code&gt;max-&lt;/code&gt; prefixes on &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;perspective&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1000px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;25rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;17rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;max-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-50%&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;&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%2Ftvx04wyfhdw7hq38vqkv.png" 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%2Ftvx04wyfhdw7hq38vqkv.png" alt="Image of rendered code above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it! Hope you enjoyed the article! Feel free to comment and if you want to have a chat, I'm &lt;a href="https://twitter.com/michael_mynah" rel="noopener noreferrer"&gt;@michael_mynah&lt;/a&gt; on Twitter.&lt;/p&gt;

&lt;p&gt;Special thanks &lt;a&gt;@perborgen&lt;/a&gt; for inspiring this post ;)&lt;/p&gt;

</description>
      <category>css</category>
      <category>5minutetutorials</category>
    </item>
  </channel>
</rss>
