<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[My blog's RSS Feed]]></title><description><![CDATA[Personal blog by Ellis Min]]></description><link>https://ellismin.com</link><generator>GatsbyJS</generator><lastBuildDate>Sun, 17 Mar 2024 01:52:20 GMT</lastBuildDate><item><title><![CDATA[test]]></title><description><![CDATA[Underline  this  word]]></description><link>https://ellismin.com/2020/06/test/</link><guid isPermaLink="false">https://ellismin.com/2020/06/test/</guid><content:encoded>&lt;p&gt;Underline &lt;div&gt;this&lt;/div&gt; word&lt;/p&gt;&lt;div&gt;Primary text&lt;/div&gt;&lt;div&gt;Some long success message &lt;div&gt;Some long success message&lt;/div&gt; Some long success message Some long success message Some long success message&lt;/div&gt;&lt;div&gt;Duis ut dolore aliqua proident deserunt Lorem laborum magna magna elit proident. Non culpa exercitation proident pariatur exercitation ad occaecat qui culpa commodo. Nisi cillum quis cupidatat nostrud consequat qui laborum eiusmod culpa irure sunt qui anim do. Cupidatat non dolor ipsum elit tempor occaecat sit magna. Ullamco incididunt labore cillum dolor aliquip labore. Consectetur laboris reprehenderit proident reprehenderit dolore aliquip duis aliquip. Minim sit nostrud nisi velit amet duis nisi irure.&lt;/div&gt;&lt;div&gt;Duis ut dolore aliqua proident deserunt Lorem laborum magna magna elit proident. Non culpa exercitation proident pariatur exercitation ad occaecat qui culpa commodo. Nisi cillum quis cupidatat nostrud consequat qui laborum eiusmod culpa irure sunt qui anim do. Cupidatat non dolor ipsum elit tempor occaecat sit magna. Ullamco incididunt labore cillum dolor aliquip labore. Consectetur laboris reprehenderit proident reprehenderit dolore aliquip duis aliquip. Minim sit nostrud nisi velit amet duis nisi irure.&lt;/div&gt;&lt;div&gt;Duis ut dolore aliqua proident deserunt Lorem laborum magna magna elit proident. Non culpa exercitation proident pariatur exercitation ad occaecat qui culpa commodo. Nisi cillum quis cupidatat nostrud consequat qui laborum eiusmod culpa irure sunt qui anim do. Cupidatat non dolor ipsum elit tempor occaecat sit magna. Ullamco incididunt labore cillum dolor aliquip labore. Consectetur laboris reprehenderit proident reprehenderit dolore aliquip duis aliquip. Minim sit nostrud nisi velit amet duis nisi irure.&lt;/div&gt;&lt;div code=&quot;const onClick = () =&amp;gt; {
  alert(&amp;quot;You opened me!!&amp;quot;)
}
render(&amp;lt;button onClick={onClick}&amp;gt;Alohomora!&amp;lt;/button&amp;gt;)&quot; language=&quot;jsx&quot; class=&quot;live-highlight&quot; style=&quot;position:relative;text-align:left;box-sizing:border-box;padding:0;overflow:hidden;white-space:pre;font-family:monospace&quot;&gt;&lt;textarea style=&quot;margin:0;border:0;background:none;box-sizing:inherit;display:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-variant-ligatures:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;tab-size:inherit;text-indent:inherit;text-rendering:inherit;text-transform:inherit;white-space:pre-wrap;word-break:keep-all;overflow-wrap:break-word;position:absolute;top:0;left:0;height:100%;width:100%;resize:none;color:inherit;overflow:hidden;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-text-fill-color:transparent;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px&quot; class=&quot;npm__react-simple-code-editor__textarea&quot; autoCapitalize=&quot;off&quot; autoComplete=&quot;off&quot; autoCorrect=&quot;off&quot; spellcheck=&quot;false&quot; data-gramm=&quot;false&quot;&gt;const onClick = () =&amp;gt; {
  alert(&amp;quot;You opened me!!&amp;quot;)
}
render(&amp;lt;button onClick={onClick}&amp;gt;Alohomora!&amp;lt;/button&amp;gt;)&lt;/textarea&gt;&lt;pre aria-hidden=&quot;true&quot; style=&quot;margin:0;border:0;background:none;box-sizing:inherit;display:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-variant-ligatures:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;tab-size:inherit;text-indent:inherit;text-rendering:inherit;text-transform:inherit;white-space:pre-wrap;word-break:keep-all;overflow-wrap:break-word;position:relative;pointer-events:none;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px&quot;&gt;&lt;div class=&quot;token-line&quot; style=&quot;color:#C5C8C6&quot;&gt;&lt;span class=&quot;token keyword&quot; style=&quot;color:hsl(350, 40%, 70%)&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot; style=&quot;color:hsl(40, 90%, 60%)&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot; style=&quot;color:hsl(40, 90%, 60%)&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot; style=&quot;color:#C5C8C6&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot; style=&quot;color:hsl(40, 90%, 60%)&quot;&gt;&amp;quot;You opened me!!&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot; style=&quot;color:#C5C8C6&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot; style=&quot;color:#C5C8C6&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot; style=&quot;color:hsl(350, 40%, 70%);opacity:0.7&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot; style=&quot;color:hsl(350, 40%, 70%)&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot; style=&quot;color:hsl(350, 40%, 70%)&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot; style=&quot;color:hsl(75, 70%, 60%)&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot; style=&quot;color:hsl(350, 40%, 70%);opacity:0.7&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot; style=&quot;color:hsl(350, 40%, 70%);opacity:0.7&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot; style=&quot;color:hsl(350, 40%, 70%)&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot; style=&quot;color:hsl(350, 40%, 70%);opacity:0.7&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot; style=&quot;color:hsl(350, 40%, 70%);opacity:0.7&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Alohomora!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot; style=&quot;color:hsl(350, 40%, 70%);opacity:0.7&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot; style=&quot;color:hsl(350, 40%, 70%)&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot; style=&quot;color:hsl(350, 40%, 70%);opacity:0.7&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;opacity:0.7&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;style type=&quot;text/css&quot;&gt;
/**
 * Reset the text fill color so that placeholder is visible
 */
.npm__react-simple-code-editor__textarea:empty {
  -webkit-text-fill-color: inherit !important;
}

/**
 * Hack to apply on some CSS on IE10 and IE11
 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /**
    * IE doesn&apos;t support &apos;-webkit-text-fill-color&apos;
    * So we use &apos;color: transparent&apos; to make the text transparent on IE
    * Unlike other browsers, it doesn&apos;t affect caret color in IE
    */
  .npm__react-simple-code-editor__textarea {
    color: transparent !important;
  }

  .npm__react-simple-code-editor__textarea::selection {
    background-color: #accef7 !important;
    color: transparent !important;
  }
}
&lt;/style&gt;&lt;/div&gt;&lt;div class=&quot;live-preview&quot;&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;You opened me!!&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Alohomora!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Alohomora!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Alohomora!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; highlighted &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; highlighted &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; highlighted &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; highlight &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; highlight &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; highlight &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; highlight &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;long textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong textlong text&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[About]]></title><description><![CDATA[About My name is Dongbin Min (Ellis) 
You can get in touch with me via  e-mail 
Feel free to send any question or comments. Education…]]></description><link>https://ellismin.com/about/</link><guid isPermaLink="false">https://ellismin.com/about/</guid><content:encoded>&lt;h1 id=&quot;about&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#about&quot; aria-label=&quot;about permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;About&lt;/h1&gt;&lt;p&gt;My name is Dongbin Min (Ellis)&lt;br/&gt;
You can get in touch with me via &lt;a href=&quot;mailto:ellismin.dev@gmail.com&quot; target=&quot;_blank&quot;&gt;e-mail&lt;/a&gt;&lt;br/&gt;
Feel free to send any question or comments.&lt;/p&gt;&lt;h1 id=&quot;education&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#education&quot; aria-label=&quot;education permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Education&lt;/h1&gt;&lt;p&gt;&lt;em&gt;University of Wisconsin - Madison&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;Bachelor of Science - Double majored in Computer Science and Economics&lt;/em&gt;&lt;/p&gt;&lt;br/&gt;&lt;br/&gt;&lt;h1 id=&quot;personal-projects&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#personal-projects&quot; aria-label=&quot;personal projects permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Personal Projects&lt;/h1&gt;&lt;p&gt;Link to &lt;a href=&quot;http://ellismin.com/portfolio&quot;&gt;projects&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[stale]]></title><link>https://ellismin.com/2021/12/removed01/</link><guid isPermaLink="false">https://ellismin.com/2021/12/removed01/</guid><pubDate>Thu, 02 Dec 2021 00:00:00 GMT</pubDate><content:encoded></content:encoded></item><item><title><![CDATA[[Project]: Game Code Share]]></title><description><![CDATA[Motivation]]></description><link>https://ellismin.com/portfolio/game-code-share/</link><guid isPermaLink="false">https://ellismin.com/portfolio/game-code-share/</guid><pubDate>Thu, 19 Nov 2020 00:00:00 GMT</pubDate><content:encoded>&lt;a class=&quot;portfolio-link&quot; href=&quot;https://ellismin.com/portfolio&quot; target=&quot;&quot; rel=&quot;&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; data-prefix=&quot;fas&quot; data-icon=&quot;long-arrow-alt-left&quot; class=&quot;svg-inline--fa fa-long-arrow-alt-left fa-w-14 icon-fa&quot; role=&quot;img&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 448 512&quot;&gt;&lt;path fill=&quot;currentColor&quot; d=&quot;M134.059 296H436c6.627 0 12-5.373 12-12v-56c0-6.627-5.373-12-12-12H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.569 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;span&gt;Back to Portfolio&lt;/span&gt;&lt;/a&gt;&lt;h2 id=&quot;motivation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#motivation&quot; aria-label=&quot;motivation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Motivation&lt;/h2&gt;</content:encoded></item><item><title><![CDATA[[Project]: Ramen Kid]]></title><description><![CDATA[Ramen Kid Website Features This project had a huge focus on functionalities of admin who is authorized to change most of the contents on the…]]></description><link>https://ellismin.com/portfolio/ramen-kid/</link><guid isPermaLink="false">https://ellismin.com/portfolio/ramen-kid/</guid><pubDate>Tue, 10 Nov 2020 00:00:00 GMT</pubDate><content:encoded>&lt;a class=&quot;portfolio-link&quot; href=&quot;https://ellismin.com/portfolio&quot; target=&quot;&quot; rel=&quot;&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; data-prefix=&quot;fas&quot; data-icon=&quot;long-arrow-alt-left&quot; class=&quot;svg-inline--fa fa-long-arrow-alt-left fa-w-14 icon-fa&quot; role=&quot;img&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 448 512&quot;&gt;&lt;path fill=&quot;currentColor&quot; d=&quot;M134.059 296H436c6.627 0 12-5.373 12-12v-56c0-6.627-5.373-12-12-12H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.569 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;span&gt;Back to Portfolio&lt;/span&gt;&lt;/a&gt;&lt;p&gt;&lt;a href=&quot;https://ramenkid.com&quot;&gt;Ramen Kid Website&lt;/a&gt;&lt;/p&gt;&lt;h2 id=&quot;features&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#features&quot; aria-label=&quot;features permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Features&lt;/h2&gt;&lt;p&gt;This project had a huge focus on functionalities of admin who is authorized to change most of the contents on the website. You can click any image to zoom.&lt;/p&gt;&lt;h3 id=&quot;responsive-design&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#responsive-design&quot; aria-label=&quot;responsive design permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Responsive design&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:67.90697674418605%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAAD4ElEQVQ4y4VTbUxTZxQ+9Iv23pZS7AdQaEtLgdIiKx9m2rWWiRWEDBwVhA0IoBEc2xxjbiHMuTDjD41GM5Nl/sHOgo5hhkxjke8glAkbSNmmRjYjS6SgLpk/GJfes1sWR7b92Eme5OQ5z/u857wnL8D/RKaGhPTYUIgRAESwAST89Vp0dDRERkZCWFjYOkmSJIsgSSAIspQUCjuEIlGrSCR0CQV8l4jku7QxUpeOgVImdskjwlwKqaQ1XBzWzuiOp6ZuJA83N0N6ejqLx+MCm83cyJixBQIBcLnccyKRCDUaDeri1BgXLUUJycW8TbFYnGXCjHgZpiQZ0GjKQNmGCBQQxGOmATI1NRW2bcsGvV4POp0OQCgUsoMdcnm8U2KxGJXKmGVtnJpyWMyUZaOWchgJynVsH9Ww30mZMnIoe85rK1GyCJTK5PM2q2XHzpycF7O3O/RWmx2sVhsz8rrhmaChIjKKMsSr6F1ZaejYbETnFhV+3lSMRXk21Bm3oiVtK52sUmJ8QgIdHiGlCFKIOp12EhE5DP5pGB4uRqlcTmljo+kDrzqwvrQC6/Y4sSo/C9PNFnQW7sKP95ajPcVIa7QaNCdEBkx6NSYmmX7ClafEb08XAJh3YzNjQ2ho6BlJuATlCgUVK1fQlbk78eybVdhUlouNxZlYun0TlluT8UOnjba9kISbzSa6riBztbQwD+0v7Zj13+0iJsYuQ3AZbA6HE1z4aZIgkM3lrZj16sDRd6sDxw7m0yUvR+E7pWl0Q4k1cPDA/kCZTRdIUIoDr+fn0u+VOVb3OLZgXUG271TXDf7JriEAQ7KRbTAkQ2KS4azJlIKGZBParRY89NY+LHEWYUm+na6vKMDamgr86JMTWF9bhY7sLHy7ejc2V2etHm2sxCPvv+ErKqvk765pAHC3fcliAG3tHS0X3JdWmNzvbutY+sLdsdTReeXZ192ewDXP4PLwyLh/ZGTUPz3zg39yyrdQW1643Lw374/Gmlew5cih6ZbTbn7TCTeAp6cfPJ5+uNE7yO3pGRBe9wyQ495vxQAK6O8fvtDbN4hDwzcX5u7PxTBbDGXA7+vtVWrU6idymQxl0g2oUqkeBPm1LY+OTaxhYvI23By9BUPDXpj/9REwRXb3N9c/bb/41UDXlWtXveMT5jv35oI8uD87DvF6/eE4rbZVq9WdT0xM/ODvr8ccYNAJFy91ruWdl7tDgvx3U7c5Y97vWUGD358twv25Bzyv9xbcuXsvZLTv6n/+fFC31uG/Y8b3I8zM/oWH849g8bF/TfjzLw9hcekJ+HyzMDU1HZSyniMkJIT13PBP4gmoQ5RKopoAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk responsive&quot; title=&quot;rk responsive&quot; src=&quot;/static/5942e73316e4c3a626e30287c9f783ca/914ae/rk-responsive.png&quot; srcSet=&quot;/static/5942e73316e4c3a626e30287c9f783ca/2eb24/rk-responsive.png 215w,/static/5942e73316e4c3a626e30287c9f783ca/05ed2/rk-responsive.png 430w,/static/5942e73316e4c3a626e30287c9f783ca/914ae/rk-responsive.png 860w,/static/5942e73316e4c3a626e30287c9f783ca/46115/rk-responsive.png 1290w,/static/5942e73316e4c3a626e30287c9f783ca/5fc9a/rk-responsive.png 1648w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;setting-announcement&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#setting-announcement&quot; aria-label=&quot;setting announcement permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Setting announcement&lt;/h3&gt;&lt;p&gt;Admin has an option to set custom announcement that displays on the top of the page&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:56.27906976744186%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABaElEQVQoz3WSzY6CQBCEOaooCIjgH4gHUZPVxMSb7/9atf1Nts3EZA+V6enpru4qSObzudq21XK51Gw2U5qmH/h9sVgoy7Jw5nkeThDXOJLdbqfT6aTj8aiiKDSdTj+PxOSez6fe77cej4fu97ter1eIIfd6iEHSNI26rhPEbMFj2MJi7sR1XWu9XquqKpVlqdVqFe6oyqK6sCGSKcwtyTTudVXqcDgEIp/8jVgJgJTehKau77XZbEIh3rA1YAuPY+A5+M4FwsKYG5ORGRFTc5PRbbcaz2ddr1eN46jL5aLb7RbuDEH2N8izTNLgj0lO/6Rk5sWPedrv9xrsY+EtluAbJ76BmIwPh9JA2JrUYRhCg3+Q3r742TbszYq9EeOnn+QYQp2TE9OPj4n7xHQnxA/P4y0g5zF5iNgMEH82pBGSyWQSPOSRDbbmo0v0xhi8OZDNkEAIM1P9JyWJNH52ZPxHGIMaaun9Be5IDcJlEeLNAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk announcement 1&quot; title=&quot;rk announcement 1&quot; src=&quot;/static/a17aa188ac041e079ce76c56d45b59e7/914ae/rk-announcement-1.png&quot; srcSet=&quot;/static/a17aa188ac041e079ce76c56d45b59e7/2eb24/rk-announcement-1.png 215w,/static/a17aa188ac041e079ce76c56d45b59e7/05ed2/rk-announcement-1.png 430w,/static/a17aa188ac041e079ce76c56d45b59e7/914ae/rk-announcement-1.png 860w,/static/a17aa188ac041e079ce76c56d45b59e7/46115/rk-announcement-1.png 1290w,/static/a17aa188ac041e079ce76c56d45b59e7/3c492/rk-announcement-1.png 1300w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:55.81395348837209%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABkElEQVQoz41Sy27CMBDMoSrkQUgCSQghD/EIIAQUiR7a76tKgf7zdMeJaWh76GG09no8nt218bbIcN3M8Lld4L3KcVrmuOzmuOxXOG8rnHfLOja4NvnTqmz4BU5VoeLHegrDGw5RzucoZnMEUYyObePRqsH1Q7eLzX6P55dXbA8HLDcbPB2PWO92sD1PeJbwHDzaNd8YBAHKokCeZRgOBrCF0HfdOySjEdLxGHEcIwpDjGTPnC+CN16/D4eClgh4chCIMNdEIPtskiJJEkWyTBOmQJ9bVr235cxxHBUpyrXR6/WQ5Tkmk4l6hUTf9zGUVgzEMR9i/A+UIB1EdChiFt00JSdSXiqPjKVUIk3T26NtZxqudshyUynNFac8MEUwFoe5CIZRpBySqNEWaQvfCU5ns18l01UkgqEMgWALCOZY3nc/LXWHrVOCFCGJkUlVcrMmuCbowG2mqd20oaZMQbqhYHuKvMA8S+l0On+iK/9Tg3stbPCyLkP1UIT5XaqqQlmWqhWZ/NGf0HkdOTQKfgFxrhR6X7VJIwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk announcement 2&quot; title=&quot;rk announcement 2&quot; src=&quot;/static/76c92ccde2a401be8b98a7c2c046fa2a/914ae/rk-announcement-2.png&quot; srcSet=&quot;/static/76c92ccde2a401be8b98a7c2c046fa2a/2eb24/rk-announcement-2.png 215w,/static/76c92ccde2a401be8b98a7c2c046fa2a/05ed2/rk-announcement-2.png 430w,/static/76c92ccde2a401be8b98a7c2c046fa2a/914ae/rk-announcement-2.png 860w,/static/76c92ccde2a401be8b98a7c2c046fa2a/46115/rk-announcement-2.png 1290w,/static/76c92ccde2a401be8b98a7c2c046fa2a/3c492/rk-announcement-2.png 1300w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;addeditdelete-menu-items&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#addeditdelete-menu-items&quot; aria-label=&quot;addeditdelete menu items permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add/Edit/Delete menu items&lt;/h3&gt;&lt;p&gt;Admin can add, edit, delete menu items. Also one can mark particular item sold out or available.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:81.3953488372093%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAABYlAAAWJQFJUiTwAAADnUlEQVQ4y11TXXMTZRTeK2dsSfZ7s7vZ3exm89EkJNskTRNibE2KhdJY+mFqazu0kRKoIaWjKBQ6ODLCBSqMznjhDD/AK3+Ov8D/8Xjet1wwXjxzzp493+d5hbVWHpOtNg6uN9DMuLi72sSbcR+/n6zh1XEf925ewVwuQDUToJ710S6m8eVSDa4ah/ThBzDFadycz2I+NDFsexAe7XXx02gFG4sVfFxJI2Oq2OiUsVTN4vaNBt4+P8aLJ9/i2XenmNzaomSzWIyyMGLT0GNTWCgHuLtSx+2rEYaLWQif92Yx2uxgqTGDjYUKtntV5JM6NAqoZ10c9Tu4s97Fo8MbeLBzFQ/3evj5ZB2DXg2degkv7g9wOljA91tNDLsFCIf9Js5HfRzvLOPXp/t4+/IQ69RhJbDQyHnYX2rgZGsRfz7ZxS8PNnE+XMGryTpejjfxzdE2nk/28PTWp/jjXg+vhx0I4+E1nJDTaP86np3t4ux+Hz98vYp+pwLf1nGtdRnjL3p4fGcVZ4TRoIuvNhdwREWWP4qw1K6ATXm228b5zjwE27MRj4sQJRGKqkDTNKiGilwuAT/QkfR1ZLMG8vRtpzQEoYFCwUTC1ihGQixOx5ElKIoMmaQgyiJkSYZEP1VFRTpIIx2mkcszhMjmQpIB8jN0sFyaZAYzhRBB4CMMQ1iWBVGUeDyDoOgKZZY5TMuEl/Lgui6c/8NxuT3pOFy3k0mk/BTpDu9QZh0SBFkjRb2AqNDorGOySYrE9felrErcR1KlC3/5nf5eDoGNG6c9JBK0Mz+gXSgwTQsJw4ChG0ilfOiaCpu6N02T/2djWuTDpmK6rul8bQwCczAomDnbtk1GCZViHofbqyQDZNIm5ojIaZ8CqQBbvqqq3J9JURQRi8X4/lgugRkLhQKKxSIC34dEDnO1CLvLs/j7PIfffmyhWWUFbURRBa7n8kSsOJssCAKUy2UkaacXR6GsLFkURVzm8zNo1Os4Xivhn9dX8O9fp3j4WQSFxqrXajy4VLpMVMphamqa6wcHB9wei126SMiys4phJgXbsdD9pIXH4x0MqhIm9E47RYsYYMNJOvA8h2jlIRVQp8QQnWAkDLqwSh2+2yEjM4PrqbAcBa5voEScU8kWE2MoEB8NXed8MxL031NguxpRSIdn6fxRJC2Vgydke2CQZJlXYS/gEu2HHcCnK6uqRtdOodVqoU7rYJe3qGPmr1Ehxk9D1wgK/gPst+JNRyrxkgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk menu&quot; title=&quot;rk menu&quot; src=&quot;/static/63ef9dcc81e412930aaa4c412ee7ac79/914ae/rk-menu.png&quot; srcSet=&quot;/static/63ef9dcc81e412930aaa4c412ee7ac79/2eb24/rk-menu.png 215w,/static/63ef9dcc81e412930aaa4c412ee7ac79/05ed2/rk-menu.png 430w,/static/63ef9dcc81e412930aaa4c412ee7ac79/914ae/rk-menu.png 860w,/static/63ef9dcc81e412930aaa4c412ee7ac79/c1b63/rk-menu.png 1200w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:100.93023255813954%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAABYlAAAWJQFJUiTwAAACCElEQVQ4y5WUyZLqMAxFWTOFTATCGKYwVRiKYsOC//8qt49ouU3eo6t6cWNbdq4lXcmNLMsM6Pf7gjRNjdr+gsFgIP83hsOhWS6XgqIohLDX65kgCP6EMAyFuAFzVVVmv9+b4/EoY5IkJoqiXwGBv47j+EXIh029RTf/B3+P8Pw9nHCEo9FIckCovwESLp1OpybPc3FC0/MW8mq1MvP53HlRD0UxmUxknM1m/5x9C7nb7Zp2uy03+STMfS/UE9b1VLiQCQN18XK9Xps4id3PKI4djxaLhfzgk/qA1BFuNhtRGJACvZl5WZZSUrvdzozHYycAqIv1FnKr1RJIiMHPzZ1O5y0leKdVgeeUHOBiKWy8INko7Y+o6IfmzzUleMk5wH+O8HK5mPv9bk6nk7ler+Z2uwm2263YSAUeMMebw+EgKcBOulhr+7pOOZ/PMkJOO2qe9CBzRNJe17na33JY711fvU+2+tqpzAd2TbbmStvQt9fxsWxQUEm0FJijel2YwKLLZd7ZOI5cKuT5ej6f0nqoq91Bvz4eD1GPPTC2ttKuK1uP+XdNire98CeHEKIsozY/dUcpIBI3IxzI7JnSklaWHMIwtkTpC1HihdxsNl0Ba8KZY2cE7ONFYbtmY8tJXpsoMOUqNcvCvp+pJex/vzZ49+lZ99ecozsAbZgNrW1kz+T2bP7i+AImvvkMNXpazgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk menu 1&quot; title=&quot;rk menu 1&quot; src=&quot;/static/b075cbd76adf4c5b0daa94eb2c508cd6/914ae/rk-menu-1.png&quot; srcSet=&quot;/static/b075cbd76adf4c5b0daa94eb2c508cd6/2eb24/rk-menu-1.png 215w,/static/b075cbd76adf4c5b0daa94eb2c508cd6/05ed2/rk-menu-1.png 430w,/static/b075cbd76adf4c5b0daa94eb2c508cd6/914ae/rk-menu-1.png 860w,/static/b075cbd76adf4c5b0daa94eb2c508cd6/1cfc2/rk-menu-1.png 900w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:52.55813953488372%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAACFUlEQVQozz1T2W7jMAwM6vuULNvynR5pEmwcZIsCAbov/YD9if7/V8wO5XYfaNLWcKgh6V1VVTDGYJ5n54dhQN8P0FrT9+i6DkpXGMeJsUVVbVg5k1zB13XtYrFdWZYueZomftAu3s8jeiYbU8O2LfZTS19DKQ3BS2FJVowlRymFoihc7i5NU4hFUQzfCxCEER5JOLU5XuaMoAiNUciISZIEnu/D+8Y90Ls4EO850l2e5wxYSWewdYyuTfE8F/hcc/z9M+O+DjAqQ0acU6NSdE3CIhFq7WEeK6cuyzJnO3kIae4SMsrIcTqMWJcEn78G3A/sUUkV2YbJi5wSJU4Qhg8sRPKmcQodociI4xi2L1lJw9gC1/UFh8miVgkqkkn/JCGKIrRdiXFSDmeaEr3RSNIESRw5Bbufq5asWmpWprw0T9mGnLfazmQALYcjN7F9g4HFhqmD7Rq0jWGuwtgZDq/Zeij9CQKfEjxnccQ4kDh0t5Jmv7294ePjA7fbb65PD2s7d6NlWXA6ndy7MVwbSfI5uST2YXSASgVoqgCq8Pk9cGdCeLlc8P7+TsIbnp6eSGC5HRnu9zu+vr5wPB63Kf+MPAy38Yv5tDBgocB3ZxkHcji84nw+Y10vuF5X7PeL28G63hZdWvJ/sXMyz481nl9bDPTjUuORfdKyfyTr2Z+haympwf7ZEmcdbt7bbxyHyT9IFv4fkMcK233DbmkAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk menu 2&quot; title=&quot;rk menu 2&quot; src=&quot;/static/aec4ecd9d156e3c59d519caecd9dd7da/914ae/rk-menu-2.png&quot; srcSet=&quot;/static/aec4ecd9d156e3c59d519caecd9dd7da/2eb24/rk-menu-2.png 215w,/static/aec4ecd9d156e3c59d519caecd9dd7da/05ed2/rk-menu-2.png 430w,/static/aec4ecd9d156e3c59d519caecd9dd7da/914ae/rk-menu-2.png 860w,/static/aec4ecd9d156e3c59d519caecd9dd7da/46115/rk-menu-2.png 1290w,/static/aec4ecd9d156e3c59d519caecd9dd7da/3c492/rk-menu-2.png 1300w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;drag--drop-to-change-order&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#drag--drop-to-change-order&quot; aria-label=&quot;drag  drop to change order permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Drag &amp;amp; Drop to change order&lt;/h3&gt;&lt;p&gt;Admin can use drag &amp;amp; drop to change order of menu items using &lt;a href=&quot;https://github.com/atlassian/react-beautiful-dnd&quot;&gt;react-beautiful-dnd&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:568px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:79.06976744186048%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAABYlAAAWJQFJUiTwAAABgElEQVQ4y42U6ZKCQAyEfQIUj1JURLxRwQMV3//FsvWlKtaMO+76I5VhmOl0pwOtOI7FjU6no3kwGEi/39ewNbnX673OhKIVAuTydruVzWYj8/lcjsejrFYrfZ7NZtJut78HNNDpdKpgaZpKlmUaPMPyT8AQfS7A8Hq9SlVVcrvd5Pl8Sl3XMh6PfwEaBrllCwsDTJJEJRZFoeBInkwmHsA7mMew2+16h5AGSFmW2kOAaYMVpqgx9RiyORwO5XA46CXyfr/XOJ1OCkaY/PP5LJfLReXf73fZ7XZeC16AvCAAXS6XslgsdA0w+xRi38yxjGluC4KSbU0PYQNT+shl3pnkKIo82UFTXGPW67WCIZVeYlRoZIIM3w9QHRNghnRawMD/C/jpS6FHSHZNyvNcR+erT8+VikkAAIZk+ojLZJiG5tADdOfI1swgUnGYNYHLo9FIi7png5LZxEFzEXk2i+7XAiD95a/zkaFJRY45akOM1MfjoYNsuWkaLURr3k36AdxNnT528sP5AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk dnd&quot; title=&quot;rk dnd&quot; src=&quot;/static/ebd6368b76bacd860867670b885c8498/10e91/rk-dnd.png&quot; srcSet=&quot;/static/ebd6368b76bacd860867670b885c8498/2eb24/rk-dnd.png 215w,/static/ebd6368b76bacd860867670b885c8498/05ed2/rk-dnd.png 430w,/static/ebd6368b76bacd860867670b885c8498/10e91/rk-dnd.png 568w&quot; sizes=&quot;(max-width: 568px) 100vw, 568px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;dynamically-generate-pdf&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#dynamically-generate-pdf&quot; aria-label=&quot;dynamically generate pdf permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Dynamically generate PDF&lt;/h3&gt;&lt;p&gt;Based on the menu item stored in database, it automatically creates menu in PDF format using &lt;a href=&quot;https://react-pdf.org/&quot;&gt;react-pdf&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:74.88372093023256%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAABYlAAAWJQFJUiTwAAAC+UlEQVQ4yz1Th5KiQBTk/3/pwp6ru2ZhEXFVggqiiBgIK8a+fnOBqldTM/p6+nX3aNEigHzxJoZlfGC7jlGlGc5ZjvO5QpZleH2to9lsoaoq3G53XK9XnHj+8vLC8yZqtRriOMbz+YQWuh7ulyt8x8VQNxB6c1S7E1ICD4cWRqMRPM/Her3G4XjE6ZQhCAJ17jgO0jRFUeQ4HA7qci0OIsXQmTnQdR2+PcUtK1Wj7F1etCSA78+x2+2wiiK4novBQEe0ihTrCwntCLzZbKCNDBOrZYAuR2q/vcM2h8gPR2y3Cfr9AVqtNmZk4vs+5vM5EoImSYLFYoHJZIL9fo8jmRdFoVbt17cfmNmfqIoS2e6A4kT66R4LxyNgH7Y9Vs2beKPYyNgynjQbhoFer8dLW2p/Pp+h1b//xAeZGCydAEPLgvs5xZIjmh8mwjBUjOLtlk3UlpfNZjOMx2OlX3W5KMkETCTRat++Y9DtodfuwqAuI9um6CHmZGWzyeOook+RF8hZEc1ZLpdkbsN1Xdzvd+Xu8S9z7fWlptgNTVMZEJHRgq6uuFp0UvQLwxUdzFGWpWIV0iRT/k9A0e52uzFKlz8uv782GAsPksc4WmPL5i3XgCOP7RHWdFXAhIFkLxKXXQcWpRENpffxeKhs7oVh/VdNadV5a2JijZAle4JGSkO910Wn3kAcrJAy+Ec6KmzFJBl5yXSIUfKJWbLX2u2Ooq9Tww+WMEqYp8V0ht57k+cdBS5nEUeVUAvb1Yoy5Dke1O9GHUWeOi/XzL6hYjM1LUzIdMxy+ONy6sAeDmFKuCdTbAkYswRITGk0GvCZy8fj+R80Sehyv9XBmKNadNjs9GD3dXwy3HNq0357w5igHl+RzyiJ6DlNCGhYl8kQx+/UT6qqLrwsgjans18U/ZSkyFlfzNq1/MKBj90aDDAZUSvXR0hW0d/3LIwE5Ent/gGquj+geZMZyvSAfLdHQcCK4BWZfPH5ldSoPMkFJbMGBSBg/0pA/u8ff+o3k3hNH50vjEkAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk pdf&quot; title=&quot;rk pdf&quot; src=&quot;/static/4dcf330269d00a49ef7c57ae871b92a8/914ae/rk-pdf.png&quot; srcSet=&quot;/static/4dcf330269d00a49ef7c57ae871b92a8/2eb24/rk-pdf.png 215w,/static/4dcf330269d00a49ef7c57ae871b92a8/05ed2/rk-pdf.png 430w,/static/4dcf330269d00a49ef7c57ae871b92a8/914ae/rk-pdf.png 860w,/static/4dcf330269d00a49ef7c57ae871b92a8/c1b63/rk-pdf.png 1200w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;editing-other-pages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#editing-other-pages&quot; aria-label=&quot;editing other pages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Editing other pages&lt;/h2&gt;&lt;p&gt;Admin can modify images in &lt;strong&gt;Home page&lt;/strong&gt;, and edit texts in &lt;strong&gt;About&lt;/strong&gt; and &lt;strong&gt;Hours &amp;amp; Location&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:91.16279069767442%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAACXBIWXMAABYlAAAWJQFJUiTwAAAEq0lEQVQ4yzWT20/TdxiHO5eJ5XxQBORQXGk5FSgWCnTlUFpKkUIPlHJqCy1QKBYolDPloHgCmQyd6NyMxsUZNSbLLha3i11sWbJdbMmym2V/zLPfz2YXb97v1ZP3+36eV5KWlkZ+fj65ubkkp6RgNdRj1KhwGzRYNUraqotRlRbToEyjQ5WE7mMpJ/MmDsLd/PnHb/z7z1901JdQKcumproeiVKppLysDLlcTpFMRkdtKdrKQoxNZTj1pTh1FTRUKeiszcPdkE57mZQ9Tx3PVu38+u4+P3x7C5UAK8w5i1LVjCQzM5MLFy6Ql5dHWno6VYpidEoZhqoyHDo1XXoNHnMNdn0ZrroMnOpEDsd1/HTDxS9vt/n5x2NkOXkUFipQaSxIEhMTSRdAqampiO+xngYm+gx8UleFqkxJhbwYY10pZp2KWW8XfksN0T4tB4FmYnMjTIwOUZCbj6xIjqa+FUlGRoYwXe77CZOSkwn21PB4qZt781Y2/RbclmZ0tSraG6pxtFYTGjQzdrkZv6kCd5eFaoWCgvPnyU5L5WJRXhwohpKTk0OKEEp1QS6GCjmO5hpCDj1rY1a2Ql7mvS5GzXV4bS14rCYW3CYCdgddnS4qK9ToymXYTUYkYsrZ2dnvYVKplKZyNZYGIxMuD8v+K4QDS2wE1tlavMP28i5LgWGWhtoYMKr5pLYe1+guWq0eeU4mVyY3kWRlZb1XRgSKOywvUVBdXkXU6+Hl4iJfzC5zYg+yMbzIanCBkNvGqr2GqdZzBC+rmYt9TY/VhqYgC3+LNg4sKChA/LroYaVMTlnBRYa7O9iPTrE57ubzYS0bjkZWe3Vs+sxCIAZ2XApWHQrCLgMT3VoGarMZqb8Y10bcn1hJySnMNZbSp6rC02Xi8Y0Ir45mOQpVExtUs+6oY8quITLSxpKrgmhPCeHOIgbqsjAqU2kqksaB4nRS4bvShAQ2Jq2Mt2jYCI2yGg3w4mSNJ8vN7A5V4TSX0GbIxmKSMd6jZsejJdLfhLOlEq+9HVePOZ6y6KG4vzMJp5n29XC0NsPS9BBNei17Kz7eXDMJ013CosujVDg/p7mYu9E+7q242Q724hYC2r95leNHL+LA84JHmUKXnDrFQEcTv3/3DU9P9vB77UyOWAmOexjpNNFblUxXbSYr3jaOF+18GrEz5WwWXNVzeHjAgy9fx4GiNqlCIB98+JEgbQPvHu3y5vkRsYCNjtZGhn0zLHh6senOCpekEILqYmeik1thG6F+A+HxAY4+u8PzV98jEU9O/HKa0E8nSLlUksPhgpuXTw85ujLC7GA3S8FB5gZNzLubmB9uITxiZGXUzP21Ae6tDXN7Wwju7i3u7t+I37JYyUlJAvAMyvxMNnwdvP1qn4e7ETYnbWxN9xML2rke7hPedq6GHOzP2Pj7+QTPdpysRwKM9VuEdQkeJgmg/+uMNJHcrCRBjXoe7IU4WA9wbdbNw5if/TknJzEft8MOpq2NRF2tvIh28Xq3H19vM05jPde3InGgOKHYRXXOJZ+mTp6N2VyJ393O8aqPRzEPO0ErNyP9HAoVsuvxW5tYGWznyYaX8KCRmVE7segk/wFFnJkWXaGUEgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk texts 1&quot; title=&quot;rk texts 1&quot; src=&quot;/static/7979824e43ab3be7b5c654c71fe16680/914ae/rk-texts-1.png&quot; srcSet=&quot;/static/7979824e43ab3be7b5c654c71fe16680/2eb24/rk-texts-1.png 215w,/static/7979824e43ab3be7b5c654c71fe16680/05ed2/rk-texts-1.png 430w,/static/7979824e43ab3be7b5c654c71fe16680/914ae/rk-texts-1.png 860w,/static/7979824e43ab3be7b5c654c71fe16680/46115/rk-texts-1.png 1290w,/static/7979824e43ab3be7b5c654c71fe16680/3c492/rk-texts-1.png 1300w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:90.23255813953487%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAACXBIWXMAABYlAAAWJQFJUiTwAAAEJElEQVQ4y32T228UZRiH90YL7OzM7LTb3R7ZQ3f2vFtogaW23R5oKT1gC912oV1oDQUKtkAhQGOQkzQEDFoxCJHSUixtEBP1hgu9MsaYGBMTLzDRC40WLFoS/Qcev1nAkCBePHm/eQ+/ed/vYOrzB2mP6Bzas41zJw9x/vQoE5cu8M7oCE2VFexON/LJxx/y6dUpDjRXM+TycCO+hyurt5NMHMSub8Sh5FIVLmHDmhimLXoJjX4ng5117O9tZqi3jbeP72f8jdeoXruGXT21XJu8xO3PPufC+BlOrfAx4WylRX+F4upjZOevZckSK2vDOh1V5UKwXKcp6GagIcbwOp0ddSFO7N7M2NG9rAwH2NZdy+XXzzJ5cYpLE+8z2VfP9ZfXE/b3UhBJYZaWkytrNJWH6KwWgl2rdZqDLjpWeBlpjdGfCDOUaufo4SFKIxF6u9ezc3Afm6qDDGxLcnn7Bu4c6WNXohLd4SSkKbR6ckjVlNGzLo6pPeamQS8ilp1Pk7+Ql4rzWR91s+/VXcSEYKqjhrHLM6Q2ddGf3MqVvhbuHB5gvL2S/QGNfudSNhaZqfHk0RRxY2oLF9PgK6LMW0hZnkrModDVXsPAzgF8upctWxs5ff4aJwbOMnrgFOeSCSbTzYw1ljIYsZNensXm/BfZaH+BtrwsTLqrAKcjh8ICG/l2Fbtdo0ZsfLIpTqLUSW2Zi00VIdKNcVqaK2mvctOdKKE+UohL5HptMm6Bx6bgzVUwKTkaFlVBVlVUqxVJ2CJLFn57FtEiiVChhQq3TDwko7vN4jA0gj6VgjyZZbKKRRP1os5AEpis2VY0gWGtmkq2LZtAOEggFCQcjeJ0uygsLsbl8eAPBvD6dILhkCAocrVMjfZYw8CkGp0JrKoVRVHIteXSlewilUqxpaeHRG0dVYka6hsaSXanaG5ppbOzMxO32+0osoJVdPZEx2R8ZBxW9d+AZDazTJAtmcmXDSTyhHVIS8WdkzIxsyDTyFO11szIjxdPxAyracb4Gr4chYrSKK31dYLazNovfEZMEzxd87+Cj/5qxaPJeEs8xONrWLWqHN1bkvGpz6l5RvBpZEVlpctGm3iaHRVh2lb7xdpLmfAZsefV/aegMbLRhc9pIxDws7KsjFhpjGg0gu7MeZT3eORnBGWzgkWyIEtyxkpmCUmSxKZLFIiLGvQ4iIqXZBDRCyhyqOJQpMzBSWajRhb5lkdYLJiu3rzI+NwYb350kiuzb3Ft4j1u3pxmbnaGuZnrHBs9wvDwMCMjBzh08CDT16eE/wa3Zqe5OPMuUzcmuD03y22Rf+uDaUx3//yK7+e/5oeHX/Djwy+5u/AN84s/cW/+HvO//MaZU8dJp9Ps6N/O3sHd3P3uW/5+uMji4iLzCz+zcP9X/nrwO3/cn+eB4B8zlWgV9IOcUAAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk texts 2&quot; title=&quot;rk texts 2&quot; src=&quot;/static/741d0eeb1b632d249915cd3f751dd44e/914ae/rk-texts-2.png&quot; srcSet=&quot;/static/741d0eeb1b632d249915cd3f751dd44e/2eb24/rk-texts-2.png 215w,/static/741d0eeb1b632d249915cd3f751dd44e/05ed2/rk-texts-2.png 430w,/static/741d0eeb1b632d249915cd3f751dd44e/914ae/rk-texts-2.png 860w,/static/741d0eeb1b632d249915cd3f751dd44e/1cfc2/rk-texts-2.png 900w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:68.83720930232559%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAACUElEQVQ4y11T2XLaQBDk2YB13/eJ0BrZTuIYcBmbmGBScSWV//+YzsxKIlQeuubo2dbMzmriBA5UXYVmaNIqmgLDMpDmKcI4RDAgTCKJIAoQpzFM25S1fEY1+vOMiaaTkKLC0A2EYYgoipAmCdI0RZlnuBUl2kUGQejaAnWREpchzzLEUUy1KWzLIg0FmkqCikZdKT00EtUHKKqOOLCwqFy0jQtBWLUessiWnG4MtWRVEroeNCaOZ8J1dXgeF8wkTPOaxGewzCnSWCOoPSIFnjMngSkJzWAYc6qbns87ZCd15iKkwLVUHN+e8fP0hufNF3yQ/f3xju3jZ+x3WzxtHvB+2FPNDn9+nXDYP1F+TTVHOYnv6EgDE5M8djCbX+Pqaor1eovd7gWP6w1eX/c4nX5g1d3i/v6TxAvlvr0dcPh+xGazxcPDVxwORznq1XQOx6I7LEiwKAoI0dJlJ8jzHHVdoyxLQoEF+VVVypgXxTwvhM9wHedE26IgPvSsXpA3y+RiscByuZRomkbGLRWzz+Ca0Y5cVVWDcEZjG71g4PvyS+OzSejZxHGMjDoZfQbzo89gjutzel5+EPaCZeJIsaZZyi+NHTI45i4u48sOhRDnDvOiRNCPbMP3PCk6fjXL0vN9cZcjN/IcM5jjnOzQD+hJ6f3IZVWju71DK27Q0VbZZ/CG72i7XdfHQqxkTtyQXXWSa1shc3XTInCpwzqlpXj0hkKb/gIaP3QGa//LXcTMn/2LfOSbSHy6Q8vUYZsa/RUE4z87+pex+R83+L2Gjr94rIFsBEvLSgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk texts 3&quot; title=&quot;rk texts 3&quot; src=&quot;/static/c937d4ec838ed543fc9cfd148f5f9ade/914ae/rk-texts-3.png&quot; srcSet=&quot;/static/c937d4ec838ed543fc9cfd148f5f9ade/2eb24/rk-texts-3.png 215w,/static/c937d4ec838ed543fc9cfd148f5f9ade/05ed2/rk-texts-3.png 430w,/static/c937d4ec838ed543fc9cfd148f5f9ade/914ae/rk-texts-3.png 860w,/static/c937d4ec838ed543fc9cfd148f5f9ade/46115/rk-texts-3.png 1290w,/static/c937d4ec838ed543fc9cfd148f5f9ade/3c492/rk-texts-3.png 1300w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;subscription&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#subscription&quot; aria-label=&quot;subscription permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Subscription&lt;/h3&gt;&lt;p&gt;User can opt in/out for emailing list, and admin is able to sent out bulk emails to subscribers via &lt;strong&gt;Sendgrid API&lt;/strong&gt;. Subscriber data below is fake.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:100.46511627906978%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAABYlAAAWJQFJUiTwAAAB5klEQVQ4y6VU24rCQAzdZ8FrtV5qvbfWKriLCMqCbKlShUVhQdAX/8xvzXriZphVWwQfDpMO6UlyksxbPp8nQS6XUyeQyWQY8p3NZimdTvNZKBSUv463R5e4i6KI9vs9HY9H2u12tN1u2T4cDnQ6najdbnOwO0IhQFQBHOfzOW02G1qtVrRYLCgMQwqCgL/X6zXVajXOVv8XNmdoGAaVy2UyTZNRKpWUo5SNnwGRQPetVCpsc4b4CReO41C322U0m01qtVpsDwYDGo/HfA6HQz47nQ6j1+uxn+d57KtKFrElE8kKQOaNRoODWJZFxWLxzkfPXDUFXRPoIutli063jbhripSNElzX5fSFWA+kB7y1pbmqy7hEOQCEFvtZyFwqQlzats16YSSkyzLUSdClUIRoO4QHQPxyhlKyRE0SPg6KECmjTMyYDOhLhALME7ZGIA0Crt/GxX6iZMwYln25XPLGYHT6/T5vAzahYVvkv3+S9xFR+VJBXHO4KWBOpVI0nU7pfD7TZDKh2WzGj4Pv+1fSS6O+gpC+tz9Ur9djNf7XFKwYugstq9UqA6uGO8B1HRqNfCaE5rGbcvuo3q4dNgibAylAJpOgP8gP38NH0UCITLGSeFEwo+afhom7nKSJbus7G0f4C+bw+6VpVtCmAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk subscription 1&quot; title=&quot;rk subscription 1&quot; src=&quot;/static/d15381b25f1799c7dac8ea939c7b8ec7/914ae/rk-subscription-1.png&quot; srcSet=&quot;/static/d15381b25f1799c7dac8ea939c7b8ec7/2eb24/rk-subscription-1.png 215w,/static/d15381b25f1799c7dac8ea939c7b8ec7/05ed2/rk-subscription-1.png 430w,/static/d15381b25f1799c7dac8ea939c7b8ec7/914ae/rk-subscription-1.png 860w,/static/d15381b25f1799c7dac8ea939c7b8ec7/c1b63/rk-subscription-1.png 1200w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:57.20930232558139%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABH0lEQVQoz42SWW7EIBBE5wZeMIvxgjfJ6/2v1+lCQ4JjRslHqcEtnqspXkVRUJ7nVJYljX1Px3HQeZ5krSUhBFVV9ZBS6iZjNMt4zisG9l1HTdN4EPboAdzzj1DxDb26rqltW9q2jcZxJMN7nMuy7A7sGAgBAEkpv+Gx4BI9SCtJDTvUrKdDhkzTRPM80zAM5JzzowCaEs5IVbFbTUqrOxAVoH3f/T1ijbHg5rfDWFIKamr1BAaHuJNlWbxDrXUylFhGS3KtSQMBW9fVO0TFAfQ/Oiz4PtmhtTI9MoBIDkCMjpHhEpefcidE5UNx9oNDJAwogoFC6iHtlNRfocDddV3eaXh74f3F4wrxE0r7n1DwZEIo8chhHaphEELRb+AXWtkWZWbgKRgAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk subscription 2&quot; title=&quot;rk subscription 2&quot; src=&quot;/static/b5bfd887742d5ac2783d40cde5018ac9/914ae/rk-subscription-2.png&quot; srcSet=&quot;/static/b5bfd887742d5ac2783d40cde5018ac9/2eb24/rk-subscription-2.png 215w,/static/b5bfd887742d5ac2783d40cde5018ac9/05ed2/rk-subscription-2.png 430w,/static/b5bfd887742d5ac2783d40cde5018ac9/914ae/rk-subscription-2.png 860w,/static/b5bfd887742d5ac2783d40cde5018ac9/46115/rk-subscription-2.png 1290w,/static/b5bfd887742d5ac2783d40cde5018ac9/3c492/rk-subscription-2.png 1300w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:58.6046511627907%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAABYlAAAWJQFJUiTwAAABbklEQVQoz4WTyY7CMBBEuQMJCVnYsrAkLBk4gIQEEouQ+P9P6uE1OCKZYeZQKrvdLle77YbjONLr9SQIAvF9X8IwlG63q2NA3GAwGCg8zyvXYOaMXdeVRqfTkeVyKff7XU6nk/LxeFTcbjc5n8+y3+9ls9nI4XDQ8W63k8vlorher8pZlj0FcYPDKIqUmeMC5mTAGFANMA7fGYdwA1XEttutrNdrKYpCT1ssFrJarTSJKhAiFxhhA9aNsDrs9/uSpqmMx2MZjUblySbJOPwEDqk4RGQ+n0ue5+qQpGazKa1WS9Fut5Vt21Y3dRCvOOTOptOpOozjWHkymWgMBrPZTF+AKf/PkmlGkiR6l8PhUEXjJH7yC1wJm35zWXFoOklZlmXpomXZynXg5tMd4r7ikMbgLggfDzZ8JHlu2dV31Ms1sbIpCNIUnkhRfEmUhpJnj1fvvza7zg+RuiBll4IEsWsQYJ2vFgaVb/cf2Iv4N3+XM71YjhtTAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk subscription 3&quot; title=&quot;rk subscription 3&quot; src=&quot;/static/1861bbc0c139d59b5755a354b89c5212/914ae/rk-subscription-3.png&quot; srcSet=&quot;/static/1861bbc0c139d59b5755a354b89c5212/2eb24/rk-subscription-3.png 215w,/static/1861bbc0c139d59b5755a354b89c5212/05ed2/rk-subscription-3.png 430w,/static/1861bbc0c139d59b5755a354b89c5212/914ae/rk-subscription-3.png 860w,/static/1861bbc0c139d59b5755a354b89c5212/99f37/rk-subscription-3.png 1100w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;contact-form&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#contact-form&quot; aria-label=&quot;contact form permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Contact form&lt;/h3&gt;&lt;p&gt;Customers of the restaurant can send the message to the client using a contact form and via &lt;strong&gt;Sendgrid API&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:88.83720930232559%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAACXBIWXMAABYlAAAWJQFJUiTwAAABtklEQVQ4y6VUy46CQBDkbBTwCSugRAXRxWziI2YPPpJNPBgSH2c1nvz/P6i1JjsEFWU3e6j0TEPX9FRPt+I4DmazGYbDIfr9Pnzfx3w+x2AwQLfbxXg8FuvJZILpdIogCISVe8bQMt4wDCidTgfn8xnL5VIQk+x0OmGxWCAMQ6zXa6xWK+x2OxwOB0EURRE2mw2Ox6M4cLvdYr/fg8kpmqYhn8+jVCqh0Wig2WyKDwT3hG3bwlqWJdbS0sf/CoUCdF0XUIrFIiTK5XJsK5WKsPfrJOgnGEMy2piQjmq1ina7Ddd1kTzoFSSRxA0hTzNNUxAzA8qQhXvSmJBaskrUhWv+9C9COmu1WlwMCs+ANO2SyCQkkaxeFlkmITXkc6CGqqqmip5VmAdCZkYtf0P0lFA6aJkZi/IsMA3Jb8q9IzVYU69W+/uVKTILI8E3aZoG3iwXhmmldgpfwgMhnblcTjT65XIRE2Q0GsHz/GtvO1h8RfgYfkIt5FOvfnPl5MNmhTlh2HqtVkvsbdtB+M6x5v1kob++cvIUOXloWRyCFQ96PXjXOUkZsqqvPGvy+7dZr9eFblmE3/OzzGgHhr+DAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk contact&quot; title=&quot;rk contact&quot; src=&quot;/static/546554eabc90771fa06d5df71a402793/914ae/rk-contact.png&quot; srcSet=&quot;/static/546554eabc90771fa06d5df71a402793/2eb24/rk-contact.png 215w,/static/546554eabc90771fa06d5df71a402793/05ed2/rk-contact.png 430w,/static/546554eabc90771fa06d5df71a402793/914ae/rk-contact.png 860w,/static/546554eabc90771fa06d5df71a402793/00d43/rk-contact.png 1000w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;analytics&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#analytics&quot; aria-label=&quot;analytics permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Analytics&lt;/h3&gt;&lt;p&gt;Inside admin panel, admin can view the number of visitors and page hits of each pages&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:56.74418604651162%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAABFUlEQVQoz42T2W6DQAxF8wqBsC8BQihbJP7//1yOJSNooerDlcdo5sy1x9yix0OQ67pyv9+lSFP56jrph0H6vpdpmjQOa47I53mWtm0liiKJ4/igW57nUpaleJ6nUNbjOMrz+dQDKMsyleVXUiALoEQDfj4fjUEQqKqqUrFmXxiGp9qAvu+L4zhaMnAO47BpGnm9XlLXtX7jEsRBAHt3G9BqB4ZDQDh8v99aZrr2lEusBQa6BJIkSXIA8gjmhDIBd+tDnUF+Aa1PBgREqXxjg/WY0q/cHYBAbGSI9GpZlg3GRi6hBftHuQQCMpg5ZN5og20sikJd/8vhHqiDvR4+m0PyPXCvPx0C5C8g2pgA47XPnP18oG9sgAzMc2S6+gAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk analystic&quot; title=&quot;rk analystic&quot; src=&quot;/static/27bc28e22de449cc227cb2ec61850e5a/914ae/rk-analystic.png&quot; srcSet=&quot;/static/27bc28e22de449cc227cb2ec61850e5a/2eb24/rk-analystic.png 215w,/static/27bc28e22de449cc227cb2ec61850e5a/05ed2/rk-analystic.png 430w,/static/27bc28e22de449cc227cb2ec61850e5a/914ae/rk-analystic.png 860w,/static/27bc28e22de449cc227cb2ec61850e5a/46115/rk-analystic.png 1290w,/static/27bc28e22de449cc227cb2ec61850e5a/6c86f/rk-analystic.png 1720w,/static/27bc28e22de449cc227cb2ec61850e5a/1a466/rk-analystic.png 2882w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;authentication&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#authentication&quot; aria-label=&quot;authentication permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Authentication&lt;/h3&gt;&lt;p&gt;Uses &lt;strong&gt;json web token&lt;/strong&gt; to sign in user and allows to change email &amp;amp; password&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:46.51162790697674%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABqElEQVQoz22SvU7CYBSGj5SObWn56S+lPymiDAzsDl6DDMbJyc2JGJ1MJwcXb8JdExdvAg0zDl6Ahk2F4ud7GtoQYpM35/Tr+Z73nOZQDY+u64lhGBFivCU+S/RazTQbDXJsmyzLona7TZ1Oh3zfJ9wjIAh11Gq1iJNzHAhN0z4Q54VwPncc5xMXVni/B+zMc90b13VTAFMAUwBTGKSmaV5Dt8gPmHqBjwL6BUAAIADb1pPvebNukog4jgVAXC8ALus5Appyy2PbtkWz2fyp1+voRlsZhr7iHN+WXAg9orMJg2C6AGBZaF3ztQZeUhiG48FgwK7frutkcbefmZaTAZzphrFYuz9gnAlPAPMFplrCsBQDEUvg1XA4zEfxPFf0evvCsmz+p/ko/H+hZxjOeEzAeJpyzP9GPoXzOwpfVFWdqooyBWyKItYr9AbgXRRFhzA9BmyE2hE63tQROj8Bp0ee51WISJYkSQ7DQN7d68u27ciAyoDJgMkYR+IV4VVRFIVgnK/Jpnh90CFRtVql4oF7uVMszlkA8s5VgiCQcC7hcq4iLyKAO3+zkJASxaiBAwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk auth&quot; title=&quot;rk auth&quot; src=&quot;/static/71e93572e90849fa851270dcf37637e3/914ae/rk-auth.png&quot; srcSet=&quot;/static/71e93572e90849fa851270dcf37637e3/2eb24/rk-auth.png 215w,/static/71e93572e90849fa851270dcf37637e3/05ed2/rk-auth.png 430w,/static/71e93572e90849fa851270dcf37637e3/914ae/rk-auth.png 860w,/static/71e93572e90849fa851270dcf37637e3/c0255/rk-auth.png 920w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;edit-header-links&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#edit-header-links&quot; aria-label=&quot;edit header links permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Edit header links&lt;/h3&gt;&lt;p&gt;Admin can turn/off each link in the header. i.e. one can disable contact page such that it won&amp;#x27;t be shown to the public&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:74.88372093023256%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAABYlAAAWJQFJUiTwAAABlUlEQVQ4y51USXLCQAz0C8CAAXu8b7hsTMqBC7dU5ZL8/0NKt5IhJsFkOTQahNRqLYUTBIH4vi/mw242G7Xb7XYSjBnD+owx4gTrtfR1LY+nkzRNI+fzWYZhkBq+4/GowfP5XFzXvWCxWHwDYxjrhGEoeZ4rSFIUhVRVJbvdTsG3/Y3vJElkuVzKarVSO36zMyeOY02gOptsCWm7rlNfWZZqsyxTUiJNU2E+VV8URlEkBRUgmSiQmCKJwSQhAVuiClqryPM8tdZPQlUY4aOCs0ZAisF2IG3Qdrffyx5gq33fq+V3FrCFqJiFWeRzhthugsWEQADSEDB4sxW2xRkziZ3QcptWmVVJS1JejBMh4dm2jLkZfPdA6KLibDbTymM7tWX6WdyJcDsvaLFBS2yB90g1rHgr0SZ/PSNavcMYrK/5O6EPMqtmHDhFfEdhKS3OJodSzo1zGRP+hCuFnOETSDLeFobOAf9G0aRCsrJVbmh8W3/B1ZZJ+HA4SNu2ehKsdG8ht8B45ulhkzAMjfZv/3n+C+a/Ac8sgCB2yA/rAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk edit header&quot; title=&quot;rk edit header&quot; src=&quot;/static/455ebb77880a8e419911f808e0941436/914ae/rk-edit-header.png&quot; srcSet=&quot;/static/455ebb77880a8e419911f808e0941436/2eb24/rk-edit-header.png 215w,/static/455ebb77880a8e419911f808e0941436/05ed2/rk-edit-header.png 430w,/static/455ebb77880a8e419911f808e0941436/914ae/rk-edit-header.png 860w,/static/455ebb77880a8e419911f808e0941436/99f37/rk-edit-header.png 1100w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;qr-code&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#qr-code&quot; aria-label=&quot;qr code permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;QR Code&lt;/h3&gt;&lt;p&gt;Custom QR code that&amp;#x27;s linked to the menu page.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:350px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:100%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAADVElEQVQ4y31UWSuuURj9/od7xZU5uSXJLEMSGSNkHqLMQ6bM8zxlHjKm3BiuXMkUhYQoXEjIhWmds9bpO0h8tb/3ffZ+99rPWs/ajwF/f+/v73zg/v4el5eXOD09xdnZGY6OjnBycoLr62vNcTA+Pz/HxcWF5p+envAZw8C/l5cXBUNDQ/D29oazszMcHR0RGhoKPz8/xba2tggJCYGPjw+sra1hb28PDw8PrK+va+/r6+sHoDFYW1tDRkYG4uPjER0djdzcXMUJCQkCy8rKQlJSEiIjIxETE4O8vDwcHBxo79vb2wegMdjf30dOTg5aWlrQ0NCA+vp61NTUoLW1VaO4uFjzTU1N+qagoED0vwE+Pz8raG5uRmVlJfr7+9HW1ob29nYsLy8LoLq6Gg8PD5rj2ujoKEpLSzE8PIzPsn3RsKenB1VVVUhPT4evry/Ky8uVCfWjniwSZXBxcVHmXJ+amvoZsKurS4CkQs0KCwtRUVGBoqIiREVFYWxsTAx4WGNjI8rKyjA5OfkzYGdnpz4kAKnwABYgIiJCtFmstLQ0AZN2XV2d3n8E5EekHRQUhPz8fL27urpienoaIyMjcHNzk4VIu7a2VmzGx8d/B+zt7cXS0hJmZmYQFxeH4OBgZUrLUDNS3NzclHaUY2Ji4mdAVpCju7sbJSUlSExMlAzMiHrSUsycXuShtNCvlDs6OqThwMCA6NC4pLa4uChNaR0afnZ2Ftvb2yrQr5SNVc7OzkZ4eLgKwTl/f39Rc3d3l/fIgJlx7ZsPeak/+5C6ZGZmIiAgQPQogYmJiUBI28nJSRYaHBzUGg1uBCTWl5tCuhz8qK+vTwUi3Y2NDezt7WF1dVU3Z2dnB4+PjyoS5fmWobE5cANpMUM2hNTUVCQnJ+udg8VISUlR9Tlo8MPDw6/dxtjHqAdPjI2NhYWFha6bjY0NrKys1Krs7Oz+zzk4OOhJ+tSX9I0NQpS3trZgMBhgZmYGU1NT2YTgPITXkDHFp204Rz0pC2Pu4zg+Pv6o8tXVFczNzXWypaUlvLy81AxokcDAQDVbXkE237CwMM2Tiaenp8C45+7u7h+gsY/d3Nxgd3dX2c7NzWF+fl5+45OF4fvCwoKeXDfGKysruL29/U/5D+j6pk16jr+VAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;rk qr&quot; title=&quot;rk qr&quot; src=&quot;/static/dfe3a7e401c2449d1e97fcb472475a3a/13ae7/rk-qr.png&quot; srcSet=&quot;/static/dfe3a7e401c2449d1e97fcb472475a3a/2eb24/rk-qr.png 215w,/static/dfe3a7e401c2449d1e97fcb472475a3a/13ae7/rk-qr.png 350w&quot; sizes=&quot;(max-width: 350px) 100vw, 350px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[SSH]: Remote SSH to a Raspberry Pi without password (macOS, Linux)]]></title><description><![CDATA[Overview This post will show you how to  establish SSH remote connection to a Raspberry Pi or other devices without using password  via ssh…]]></description><link>https://ellismin.com/2020/09/remote-ssh-raspberry-pi/</link><guid isPermaLink="false">https://ellismin.com/2020/09/remote-ssh-raspberry-pi/</guid><pubDate>Fri, 25 Sep 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;This post will show you how to &lt;strong&gt;establish SSH remote connection to a Raspberry Pi or other devices without using password&lt;/strong&gt; via ssh-keygen&lt;/p&gt;&lt;h2 id=&quot;1-connect-to-raspberry-pi-on-terminal&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-connect-to-raspberry-pi-on-terminal&quot; aria-label=&quot;1 connect to raspberry pi on terminal permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Connect to Raspberry Pi on terminal&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pi@192.168.0.111&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Refer to this &lt;a href=&quot;https://www.raspberrypi.org/documentation/remote-access/ip-address.md#:~:text=Using%20the%20Pi%20with%20a%20display&amp;amp;text=Using%20the%20terminal%20&quot;&gt;page&lt;/a&gt; if you need to find out local ip address of pi&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;2-generate-authentication-key-on-pi&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-generate-authentication-key-on-pi&quot; aria-label=&quot;2 generate authentication key on pi permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Generate authentication key on pi&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ssh-keygen -t rsa -b &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;4096&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -C &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;your_email@example.com&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;-t rsa&lt;/code&gt; defines encryption type&lt;/p&gt;&lt;p&gt;&lt;code&gt;-b 4096&lt;/code&gt; uses 4096 bits&lt;/p&gt;&lt;p&gt;&lt;code&gt;-C&lt;/code&gt; provides a comment (in this example, email)&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;This will prompt you to enter directory and passphrase of the key. Feel free to press enter to skip these prompts. The default directory is &lt;code&gt;~/.ssh&lt;/code&gt; where the two keys will be saved: &lt;code&gt;id_rsa&lt;/code&gt; and &lt;code&gt;id_rsa.pub&lt;/code&gt;&lt;/p&gt;&lt;div padding=&quot;0.5rem 0.7rem&quot;&gt;&lt;h3 id=&quot;id_rsapub-vs-id_rsa&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#id_rsapub-vs-id_rsa&quot; aria-label=&quot;id_rsapub vs id_rsa permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;id_rsa.pub vs id_rsa&lt;/h3&gt;&lt;p&gt;&lt;code&gt;id_rsa&lt;/code&gt; is a &lt;strong&gt;private&lt;/strong&gt; key, used to sign into a remote host&lt;/p&gt;&lt;p&gt;&lt;code&gt;id_rsa.pub&lt;/code&gt; is a &lt;strong&gt;public&lt;/strong&gt; key that needs to be supplied to the remote host via &lt;code&gt;authorized_key&lt;/code&gt; file&lt;/p&gt;&lt;/div&gt;&lt;h2 id=&quot;3-add-generated-key-to-authorized-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-add-generated-key-to-authorized-key&quot; aria-label=&quot;3 add generated key to authorized key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Add generated key to authorized key&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/.ssh/id_rsa.pub &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/.ssh/authorized_key&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will generate &lt;code&gt;authorized_key&lt;/code&gt; that contains the public key&lt;/p&gt;&lt;h2 id=&quot;4-set-permissions-for-authorized-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-set-permissions-for-authorized-key&quot; aria-label=&quot;4 set permissions for authorized key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Set permissions for authorized key&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;go&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/.ssh/authorized_key&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;u&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;r ~/.ssh/authorized_key&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;go=&lt;/code&gt; adds other users for permission. &lt;code&gt;g&lt;/code&gt; indicates other uses in the file&amp;#x27;s group, and &lt;code&gt;o&lt;/code&gt; indicates other users not in the file&amp;#x27;s group.&lt;/p&gt;&lt;p&gt;&lt;code&gt;u=r&lt;/code&gt; gives the owner of the file, &lt;code&gt;u&lt;/code&gt;, permission to read&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;5-move-generated-key-to-your-device&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-move-generated-key-to-your-device&quot; aria-label=&quot;5 move generated key to your device permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Move generated key to your device&lt;/h2&gt;&lt;p&gt;Logout from pi machine to go back to your device that you wish to use to connect to pi. You&amp;#x27;ll need the private key, &lt;code&gt;~/.ssh/id_rsa&lt;/code&gt;, on your device in order to sign into the remote host, pi.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;Example&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/Documents&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Copies the private key from pi to the current directory of your device&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;scp&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pi@192.168.0.111:/home/pi/.ssh/id_rsa &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;6-connect-without-typing-in-password&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#6-connect-without-typing-in-password&quot; aria-label=&quot;6 connect without typing in password permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;6. Connect without typing in password&lt;/h2&gt;&lt;p&gt;Finally, use the below command to connect to pi without password&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;Example&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -i ~/Documents/id_rsa pi@192.168.0.111&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React]: 리액트로 카카오톡 공유 버튼 구현하기]]></title><description><![CDATA[1. 어플리케이션 등록하기 아직 어플리케이션이 kakao developers에 등록이 되어있지 않으면  kakao developers 에서 앱을 등록해 줍니다. 2. JavaScript키 리액트로 카카오톡 공유를 구현하기 위해선 JavaScript…]]></description><link>https://ellismin.com/2020/09/share-kakao/</link><guid isPermaLink="false">https://ellismin.com/2020/09/share-kakao/</guid><pubDate>Wed, 09 Sep 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;1-어플리케이션-등록하기&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-%EC%96%B4%ED%94%8C%EB%A6%AC%EC%BC%80%EC%9D%B4%EC%85%98-%EB%93%B1%EB%A1%9D%ED%95%98%EA%B8%B0&quot; aria-label=&quot;1 어플리케이션 등록하기 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. 어플리케이션 등록하기&lt;/h2&gt;&lt;p&gt;아직 어플리케이션이 kakao developers에 등록이 되어있지 않으면 &lt;a href=&quot;https://developers.kakao.com/&quot;&gt;kakao developers&lt;/a&gt;에서 앱을 등록해 줍니다.&lt;/p&gt;&lt;h2 id=&quot;2-javascript키&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-javascript%ED%82%A4&quot; aria-label=&quot;2 javascript키 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. JavaScript키&lt;/h2&gt;&lt;p&gt;리액트로 카카오톡 공유를 구현하기 위해선 JavaScript 키가 필요합니다. 어플 등록 이후에 &lt;code&gt;요약정보&lt;/code&gt; 탭에서 자바스크립트 키를 메모해 둡니다. 예: &lt;code&gt;52ke87d146ek29e688e39dkfn8b0ef28&lt;/code&gt;&lt;/p&gt;&lt;h3 id=&quot;env&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#env&quot; aria-label=&quot;env permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;.env&lt;/h3&gt;&lt;p&gt;자바스크립트 키를 .env 에 저장해둡니다&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/.env&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;REACT_APP_KAKAO_KEY=52ke87d146ek29e688e39dkfn8b0ef28 &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;REACT_FETCH_URL=https://yourSite.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;3-include-script&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-include-script&quot; aria-label=&quot;3 include script permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Include script&lt;/h2&gt;&lt;p&gt;리액트 앱에 &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;를 사용하려면 일반적으로 두가지 방법이 있습니다&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;1. Helmet 패키지 사용&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../components/Layout/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Helmet&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react-helmet&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;KakaoShareButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../KakaoShareButton&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div className&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;layout&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Include Kakao sdk */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Helmet&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;script src&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://developers.kakao.com/sdk/js/kakao.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Helmet&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;KakaoShareButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;2. 마운트 시 include&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../components/Layout/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;KakaoShareButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../KakaoShareButton&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; script &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;script&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://developers.kakao.com/sdk/js/kakao.js&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;removeChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div className&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;layout&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;KakaoShareButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;div title=&quot;script 사용을 여러군데에서 할 경우&quot;&gt;&lt;p&gt;script 사용을 여려군데서 사용해야할 경우엔 custom hook을 이용할 수 있습니다&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;hooks/use-script.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;useScript&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; script &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;script&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; url&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;removeChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; useScript&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;사용법은 다음과 같습니다:&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../components/Layout/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;useScript&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../../hooks/use-script&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useScript&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://developers.kakao.com/sdk/js/kakao.js&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div className&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;layout&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;KakaoShareButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;Kakao SDK를 마운트 시킨 이후에 &lt;code&gt;windows.Kakao&lt;/code&gt;로 접근이 가능합니다. 이를 위해 상위 component (예: &lt;code&gt;Layout&lt;/code&gt;)에서 스크립트를 미리 불러와 주세요.&lt;/p&gt;&lt;p&gt;이후에 공유하는 컨텐트 정보는 하위 컴포넌트 &lt;code&gt;KakaoShareButton&lt;/code&gt;에서 구현합니다&lt;/p&gt;&lt;/div&gt;&lt;h2 id=&quot;4-하위-컴포넌트-kakaosharebutton&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-%ED%95%98%EC%9C%84-%EC%BB%B4%ED%8F%AC%EB%84%8C%ED%8A%B8-kakaosharebutton&quot; aria-label=&quot;4 하위 컴포넌트 kakaosharebutton permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. 하위 컴포넌트 KakaoShareButton&lt;/h2&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../components/KakaoShareButton/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;KakaoShareButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createKakaoButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;createKakaoButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// kakao sdk script이 정상적으로 불러와졌으면 window.Kakao로 접근이 가능합니다&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access maybe-class-name&quot;&gt;Kakao&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; kakao &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access maybe-class-name&quot;&gt;Kakao&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// 중복 initialization 방지&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;kakao&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;isInitialized&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// 두번째 step 에서 가져온 javascript key 를 이용하여 initialize&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        kakao&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_KAKAO_KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      kakao&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access maybe-class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createDefaultButton&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Render 부분 id=kakao-link-btn 을 찾아 그부분에 렌더링을 합니다&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;#kakao-link-btn&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;objectType&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;feed&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;타이틀&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;#리액트 #카카오 #공유버튼&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;imageUrl&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;IMAGE_URL&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// i.e. process.env.FETCH_URL + &amp;#x27;/logo.png&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mobileWebUrl&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;webUrl&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;social&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;likeCount&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;77&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;commentCount&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;55&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;sharedCount&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;buttons&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;웹으로 보기&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mobileWebUrl&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;webUrl&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;앱으로 보기&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mobileWebUrl&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;webUrl&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div className&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;kakao-share-button&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Kakao share button */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;button id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;kakao-link-btn&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;img src&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/icons/kakao.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; alt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;kakao-share-icon&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;KakaoShareButton&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[VSCode]: Settings]]></title><description><![CDATA[VS Code Tips Enable  code .  inside terminal Open command pallette with (cmd + shift + P) Type in shell command to find  Shell Command…]]></description><link>https://ellismin.com/personal/vscode-setting/</link><guid isPermaLink="false">https://ellismin.com/personal/vscode-setting/</guid><pubDate>Tue, 19 May 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h1 id=&quot;vs-code-tips&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#vs-code-tips&quot; aria-label=&quot;vs code tips permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;VS Code Tips&lt;/h1&gt;&lt;h3 id=&quot;enable-code--inside-terminal&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#enable-code--inside-terminal&quot; aria-label=&quot;enable code  inside terminal permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Enable &lt;code&gt;code .&lt;/code&gt; inside terminal&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Open command pallette with (cmd + shift + P)&lt;/li&gt;&lt;li&gt;Type in shell command to find &lt;code&gt;Shell Command: Install &amp;#x27;code&amp;#x27; command in PATH&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;shortcuts&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#shortcuts&quot; aria-label=&quot;shortcuts permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Shortcuts&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Navigation&lt;ul&gt;&lt;li&gt;Cmd + shift + E: Open Explorer&lt;/li&gt;&lt;li&gt;Ctrl + shift + G: Open GitHub GUI&lt;/li&gt;&lt;li&gt;Cmd + B: Open/close sidebar&lt;/li&gt;&lt;li&gt;Ctrl + Shift + -&amp;gt;/&amp;lt;- Expand selection&lt;/li&gt;&lt;li&gt;Creating a new file: Open explorer with cmd + shirt + E. Select folder. Open pallet with cmd + shift + p. Type New file or New folder&lt;/li&gt;&lt;li&gt;Cmd + J: Open/close bottom navigation panel&lt;/li&gt;&lt;li&gt;Cmd + `: Open/close terminal &amp;amp; focus&lt;/li&gt;&lt;li&gt;Cmd + 1: Focus on Editor&lt;/li&gt;&lt;li&gt;Cmd + 2: Focus on 2nd Editor (or open it)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Moving around&lt;ul&gt;&lt;li&gt;Jumpy: need to set shortcut. Shift + Enter to start jumpy mode. Space bar to exit jumpy mode&lt;/li&gt;&lt;li&gt;command + d to select other words&lt;/li&gt;&lt;li&gt;Multi Line Tricks plugin&lt;ul&gt;&lt;li&gt;Cmd + shift + L&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Cmd + X to delete the whole line&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Shortcuts&lt;ul&gt;&lt;li&gt;type &lt;code&gt;clg&lt;/code&gt; to show auto complete for &lt;code&gt;console.log&lt;/code&gt;&lt;/li&gt;&lt;li&gt;command pallet: cmd + shift + p. Type &lt;code&gt;Fold level 2&lt;/code&gt; to display function names only&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h1 id=&quot;plugins&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#plugins&quot; aria-label=&quot;plugins permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Plugins&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Auto Close Tag&lt;/li&gt;&lt;li&gt;Babel JavaScript&lt;/li&gt;&lt;li&gt;Bittersweet Theme&lt;/li&gt;&lt;li&gt;Code Spell Checker&lt;/li&gt;&lt;li&gt;Color Highlight&lt;/li&gt;&lt;li&gt;Community Material Theme&lt;/li&gt;&lt;li&gt;ES7 React/Redux/Graphql Snippets&lt;/li&gt;&lt;li&gt;ESLint&lt;/li&gt;&lt;li&gt;Highlight Matching Tag&lt;/li&gt;&lt;li&gt;Live Server&lt;/li&gt;&lt;li&gt;Lorem ipsum&lt;/li&gt;&lt;li&gt;Markdown Preview Enhanced&lt;/li&gt;&lt;li&gt;Material Icon Theme&lt;/li&gt;&lt;li&gt;Material Theme&lt;/li&gt;&lt;li&gt;Material Theme Icons&lt;/li&gt;&lt;li&gt;Path Intellisense&lt;/li&gt;&lt;li&gt;Prettier - Code formatter&lt;/li&gt;&lt;li&gt;pug formatter&lt;/li&gt;&lt;li&gt;Python&lt;/li&gt;&lt;li&gt;Rainbow Brackets&lt;/li&gt;&lt;li&gt;Reactjs code snippets&lt;/li&gt;&lt;li&gt;Snazzy Operaotr (theme)&lt;/li&gt;&lt;li&gt;Spirited Away Color Theme&lt;/li&gt;&lt;li&gt;TODO Highlight&lt;/li&gt;&lt;li&gt;vscode-styled-components&lt;/li&gt;&lt;li&gt;Git lens&lt;/li&gt;&lt;li&gt;Project manager&lt;/li&gt;&lt;/ul&gt;&lt;h1 id=&quot;setting&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#setting&quot; aria-label=&quot;setting permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Setting&lt;/h1&gt;&lt;p&gt;To change the setting, open the vs code setting with &lt;code&gt;cmd + ,&lt;/code&gt; then search for &lt;code&gt;json&lt;/code&gt;. Click &lt;code&gt;edit in setting.json&lt;/code&gt; under Launch panel.&lt;/p&gt;&lt;h3 id=&quot;enable-emmet&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#enable-emmet&quot; aria-label=&quot;enable emmet permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Enable emmet&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;emmet.includeLanguages&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;javascriptreact&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;changing-colors-of-terminal&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#changing-colors-of-terminal&quot; aria-label=&quot;changing colors of terminal permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Changing colors of terminal&lt;/h3&gt;&lt;p&gt;When using snazzy operator theme, &lt;code&gt;undefined&lt;/code&gt; keyword doesn&amp;#x27;t show unless you tweak the terminal color with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.colorCustomizations&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;terminal.ansiBrightBlack&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;#b57575&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;personal-setting&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#personal-setting&quot; aria-label=&quot;personal setting permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Personal setting&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;update.mode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;none&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.minimap.enabled&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;breadcrumbs.enabled&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.editor.enablePreview&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[markdown]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[javascript]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.colorCustomizations&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;terminal.ansiBrightBlack&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;#b57575&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.background&amp;quot;:&amp;quot;#000&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.foreground&amp;quot;:&amp;quot;#E0E0E0&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminalCursor.background&amp;quot;:&amp;quot;#E0E0E0&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminalCursor.foreground&amp;quot;:&amp;quot;#E0E0E0&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBlack&amp;quot;:&amp;quot;#000000&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBlue&amp;quot;:&amp;quot;#6FB3D2&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBrightBlue&amp;quot;:&amp;quot;#6FB3D2&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBrightCyan&amp;quot;:&amp;quot;#76C7B7&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBrightGreen&amp;quot;:&amp;quot;#A1C659&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBrightMagenta&amp;quot;:&amp;quot;#D381C3&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBrightRed&amp;quot;:&amp;quot;#FB0120&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBrightWhite&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiBrightYellow&amp;quot;:&amp;quot;#FDA331&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiCyan&amp;quot;:&amp;quot;#76C7B7&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiGreen&amp;quot;:&amp;quot;#A1C659&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiMagenta&amp;quot;:&amp;quot;#D381C3&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiRed&amp;quot;:&amp;quot;#FB0120&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiWhite&amp;quot;:&amp;quot;#E0E0E0&amp;quot;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;terminal.ansiYellow&amp;quot;:&amp;quot;#FDA331&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[html]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;cSpell.userWords&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;add&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;afterbegin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;beforeend&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;boxshadow&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;btns&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;btwn&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;captcha&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;cart&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;chmod&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;codepen&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;collapsable&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;component&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;csrf&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;deauthenticate&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;destructured&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;dmin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;dropdown&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;droppable&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;ellismin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;elmt&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;emin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;frontmatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;geoip&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;graphiql&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;hacky&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;ingred&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;iphone&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;kakao&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;launchd&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;linkedin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mern&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;metastring&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;middlewares&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;minimalistic&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mkdir&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mult&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;noopener&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;noreferrer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;nums&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;originalname&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;page&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;pageview&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;personalizations&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;polyfill&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;predeploy&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;ramenkid&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;recaptcha&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;resave&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;result&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;sendgrid&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;signin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;signup&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;sitekey&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;staatliches&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;steelblue&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;templating&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;uncategorized&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;uniqid&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;unmount&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;unmounting&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;unsubscription&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;upsert&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;will&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;window.zoomLevel&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;liveServer.settings.donotShowInfoMsg&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;terminal.integrated.shell.osx&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/bin/zsh&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[jsonc]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.iconTheme&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;material-icon-theme&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;emmet.includeLanguages&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;javascriptreact&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[json]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;liveServer.settings.donotVerifyTags&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.colorTheme&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Snazzy Operator&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;javascript.updateImportsOnFileMove.enabled&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;always&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;files.associations&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;*.ejs&amp;quot;: &amp;quot;html&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// &amp;quot;*.md&amp;quot;: &amp;quot;mdx&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;*.mdx&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;markdown&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;secondary-vscode-setting&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#secondary-vscode-setting&quot; aria-label=&quot;secondary vscode setting permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Secondary vscode setting&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.colorTheme&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Snazzy Operator&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.colorCustomizations&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;terminal.ansiBrightBlack&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;#b57575&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.formatOnSave&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[typescript]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[typescriptreact]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;window.zoomLevel&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[html]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[javascript]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;workbench.iconTheme&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;material-icon-theme&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;[json]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.defaultFormatter&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;esbenp.prettier-vscode&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;editor.tabSize&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;launch&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;configurations&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;compounds&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Next.js]: Implementing infinite scroll in Next.js]]></title><description><![CDATA[Overview This post will explain how to build  infinite scrolling  with server side rendering in Next.js. Install packages Unless you're…]]></description><link>https://ellismin.com/2020/05/next-infinite-scroll/</link><guid isPermaLink="false">https://ellismin.com/2020/05/next-infinite-scroll/</guid><pubDate>Tue, 12 May 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;This post will explain how to build &lt;strong&gt;infinite scrolling&lt;/strong&gt; with server side rendering in Next.js.&lt;/p&gt;&lt;h2 id=&quot;install-packages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-packages&quot; aria-label=&quot;install packages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install packages&lt;/h2&gt;&lt;p&gt;Unless you&amp;#x27;re using Next.js @^9.4, you need to install &lt;code&gt;node-fetch&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i node-fetch&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;getserversideprops&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#getserversideprops&quot; aria-label=&quot;getserversideprops permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;getServerSideProps()&lt;/h2&gt;&lt;p&gt;We define &lt;code&gt;getServerSideProps()&lt;/code&gt; that is not much different from a regular fetch function, but the difference is that the server generates the page HTML upon each request, and it can exist only inside a page component.&lt;/p&gt;&lt;p&gt;Since we&amp;#x27;re building an infinite scroll, we&amp;#x27;re not going to fetch the whole data at once, but instead, we&amp;#x27;ll request a partial data from the server by using &lt;code&gt;query&lt;/code&gt; parameter that contains which &lt;code&gt;page&lt;/code&gt; to navigate to. It will later be passed from &lt;code&gt;UserList&lt;/code&gt; component.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/pages/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node-fetch&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../components/UserList&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;HomePage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;home-page&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;getServerSideProps&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Fetch the first page as default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Fetch data from external API&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;FETCH_URL&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;/users?page=&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Failed to fetch&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    userData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    userData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Pass data to the page via props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;HomePage&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;backend-api&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#backend-api&quot; aria-label=&quot;backend api permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Backend API&lt;/h2&gt;&lt;p&gt;Let&amp;#x27;s take a look at server side API for retrieving user. It returns 30 users per load (&lt;code&gt;perPage&lt;/code&gt;) along with current page (&lt;code&gt;curPage&lt;/code&gt;) and maximum Page (&lt;code&gt;maxPage&lt;/code&gt;).&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;getUsers&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curPage &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Display 30 users per page load&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; perPage &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Fetch users based on current page * perPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;perPage &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; totalUsers &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;countDocuments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Fetched users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;maxPage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;ceil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;totalUsers &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; perPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ... }&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;userlist-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#userlist-component&quot; aria-label=&quot;userlist component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;UserList component&lt;/h2&gt;&lt;p&gt;&lt;code&gt;UserList&lt;/code&gt; renders list of users, and scrolling to the last user triggers fetch for the new page with &lt;code&gt;handleScroll&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useRouter &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next/router&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./styles.scss&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useRouter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set users from userData&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Listen to scroll positions for loading more data on scroll&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;scroll&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; handleScroll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;removeEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;scroll&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; handleScroll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleScroll&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// To get page offset of last user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoaded &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.user-list &amp;gt; .user:last-child&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lastUserLoaded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoadedOffset &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        lastUserLoaded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;offsetTop&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoaded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;clientHeight&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pageOffset &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;pageYOffset&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerHeight&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Detects when user scrolls down till the last user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;pageOffset &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoadedOffset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Stops loading&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;maxPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Trigger fetch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;adding-loader-between-page-navigation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#adding-loader-between-page-navigation&quot; aria-label=&quot;adding loader between page navigation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding loader between page navigation&lt;/h2&gt;&lt;p&gt;Currently, scrolling down to the last user may &lt;strong&gt;trigger fetch multiple times!&lt;/strong&gt;. You&amp;#x27;ll need to add a &lt;code&gt;Router&lt;/code&gt; event to detect whether the fetch has ended to prevent multiple fetches.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useRouter &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next/router&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./styles.scss&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useRouter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;startLoading&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;stopLoading&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set up user data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Error check&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Router event handler&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeStart&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; startLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeComplete&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stopLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeStart&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; startLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeComplete&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stopLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Listen to scroll positions for loading more data on scroll&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;scroll&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; handleScroll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;removeEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;scroll&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; handleScroll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleScroll&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// To get page offset of last user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoaded &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.user-list &amp;gt; .user:last-child&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lastUserLoaded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoadedOffset &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        lastUserLoaded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;offsetTop&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoaded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;clientHeight&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pageOffset &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;pageYOffset&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerHeight&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;pageOffset &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lastUserLoadedOffset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Stops loading&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* IMPORTANT: Add !loading  */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;maxPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Trigger fetch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;loading &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Loading ...&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;extra-styling-for-user&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#extra-styling-for-user&quot; aria-label=&quot;extra styling for user permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extra: Styling for user&lt;/h2&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/styles.scss&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-scss&quot;&gt;SCSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-scss&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.user &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.user-list &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;list-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.user &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Next.js]: Implementing pagination in Next.js]]></title><description><![CDATA[Overview This post will explain how to build  pagination  with server side rendering in Next.js. Install packages Unless you're using Next…]]></description><link>https://ellismin.com/2020/05/next-pagination/</link><guid isPermaLink="false">https://ellismin.com/2020/05/next-pagination/</guid><pubDate>Mon, 11 May 2020 00:00:03 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;This post will explain how to build &lt;strong&gt;pagination&lt;/strong&gt; with server side rendering in Next.js.&lt;/p&gt;&lt;h2 id=&quot;install-packages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-packages&quot; aria-label=&quot;install packages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install packages&lt;/h2&gt;&lt;p&gt;Unless you&amp;#x27;re using Next.js @^9.4, you need to install &lt;code&gt;node-fetch&lt;/code&gt;, and we&amp;#x27;ll use &lt;code&gt;react-paginate&lt;/code&gt; for pagination component&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i node-fetch react-paginate&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;getserversideprops&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#getserversideprops&quot; aria-label=&quot;getserversideprops permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;getServerSideProps()&lt;/h2&gt;&lt;p&gt;We define &lt;code&gt;getServerSideProps()&lt;/code&gt; that is not much different from a regular fetch function, but the difference is that the server generates the page HTML upon each request, and it can exist only inside a page component.&lt;/p&gt;&lt;p&gt;Since we&amp;#x27;re building a pagination, we&amp;#x27;re not going to fetch the whole data at once, but instead, we&amp;#x27;ll request a partial data from the server by using &lt;code&gt;query&lt;/code&gt; parameter that contains which &lt;code&gt;page&lt;/code&gt; to navigate to. It will later be passed from &lt;code&gt;UserList&lt;/code&gt; component.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/pages/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node-fetch&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../components/UserList&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;HomePage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div className&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;home-page&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userData&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;getServerSideProps&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Fetch the first page as default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Fetch data from external API&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;FETCH_URL&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;/users?page=&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Failed to fetch&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    userData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    userData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Pass data to the page via props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;HomePage&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;backend-api&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#backend-api&quot; aria-label=&quot;backend api permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Backend API&lt;/h2&gt;&lt;p&gt;Let&amp;#x27;s take a look at server side API for retrieving user. It returns 10 users (defined in &lt;code&gt;perPage&lt;/code&gt;) along with current page (&lt;code&gt;curPage&lt;/code&gt;) and maximum Page (&lt;code&gt;maxPage&lt;/code&gt;).&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;getUsers&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curPage &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Display 10 users per page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; perPage &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Fetch users based on current page * perPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;skip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;curPage &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; perPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;perPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; totalUsers &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;countDocuments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Fetched users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;maxPage&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;ceil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;totalUsers &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; perPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ... }&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;userlist-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#userlist-component&quot; aria-label=&quot;userlist component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;UserList component&lt;/h2&gt;&lt;p&gt;&lt;code&gt;UserList&lt;/code&gt; renders list of users and pagination component which triggers fetch for the new page with &lt;code&gt;handlePagination&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;ReactPaginate&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-paginate&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useRouter &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next/router&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./styles.scss&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useRouter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set users from userData&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Triggers fetch for new page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handlePagination&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;selected&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;ReactPaginate&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;marginPagesDisplayed&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;pageRangeDisplayed&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;previousLabel&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;previous&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;nextLabel&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;breakLabel&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;...&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;initialPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;pageCount&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;maxPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onPageChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handlePagination&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;adding-loader-between-page-navigation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#adding-loader-between-page-navigation&quot; aria-label=&quot;adding loader between page navigation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding loader between page navigation&lt;/h2&gt;&lt;p&gt;Since navigating to different page requires re-fetch, you can add your custom loader with &lt;code&gt;Router&lt;/code&gt; events.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useRouter &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next/router&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;startLoading&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;stopLoading&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Router event handler&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeStart&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; startLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeComplete&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stopLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeStart&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; startLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;routeChangeComplete&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stopLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;loading &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Loading..&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* ... */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;scrollintoview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#scrollintoview&quot; aria-label=&quot;scrollintoview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;scrollIntoView()&lt;/h2&gt;&lt;p&gt;If your pagination component is placed below a long user list, scrolling up after clicking a page may be more user friendly. You can use &lt;code&gt;useRef&lt;/code&gt; to assign a ref to a DOM element to scroll up with &lt;code&gt;scrollIntoView()&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useRef &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userListRef &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useRef&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handlePagination&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;selected&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    userListRef&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;current&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;scrollIntoView&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userListRef&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;loading &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Loading ...&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* ... */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;extra-styling-for-user--paginate-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#extra-styling-for-user--paginate-component&quot; aria-label=&quot;extra styling for user  paginate component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extra: Styling for user &amp;amp; paginate component&lt;/h2&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./styles.scss&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userData &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ....&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* ... */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;ReactPaginate&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;marginPagesDisplayed&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;pageRangeDisplayed&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;previousLabel&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;previous&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;nextLabel&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;breakLabel&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;...&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;initialPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;curPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;pageCount&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userData&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;maxPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onPageChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handlePagination&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;containerClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-wrap&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;subContainerClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-inner&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;pageClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-li&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;pageLinkClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-a&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;activeClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-active&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;nextLinkClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-next-a&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;previousLinkClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-prev-a&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;breakLinkClassName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;paginate-break-a&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserList&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/UserList/styles.scss&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-scss&quot;&gt;SCSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-scss&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token property variable&quot;&gt;$purple-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#745788&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token property variable&quot;&gt;$purple-color-lighter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#d9c5e6&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.user &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.user-list &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;list-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.user &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Pagination styling&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.paginate-wrap &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;align-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;list-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;body.light &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#fafafa&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.paginate-a,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;  .paginate-next-a,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;  .paginate-prev-a,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;  .paginate-break-a &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pointer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.4&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;:focus &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;outline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;:hover &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$purple-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$purple-color-lighter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.paginate-li &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.paginate-next-a,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;  .paginate-prev-a &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$purple-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.paginate-active &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$purple-color-lighter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$purple-color-lighter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.paginate-disabled &amp;gt; a &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; not-allowed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;transparent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#666&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;body.light &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;:hover &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;transparent&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Next.js]: Using environment(env) variables in Next.js]]></title><description><![CDATA[Overview This post will show you how to set up env variables in Next.js dynamically. i.e. Using  .env.development  on development and  .env…]]></description><link>https://ellismin.com/2020/05/next-env-variables/</link><guid isPermaLink="false">https://ellismin.com/2020/05/next-env-variables/</guid><pubDate>Mon, 11 May 2020 00:00:02 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;This post will show you how to set up env variables in Next.js dynamically. i.e. Using &lt;code&gt;.env.development&lt;/code&gt; on development and &lt;code&gt;.env.production&lt;/code&gt; on production.&lt;/p&gt;&lt;h2 id=&quot;env&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#env&quot; aria-label=&quot;env permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;.env&lt;/h2&gt;&lt;p&gt;Create &lt;code&gt;.env.development&lt;/code&gt; and &lt;code&gt;.env.production&lt;/code&gt; for client side&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/.env.development&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;FETCH_URL=http://localhost:3000&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/.env.production&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;FETCH_URL=https://your-website.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;install-dotenv-webpack&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-dotenv-webpack&quot; aria-label=&quot;install dotenv webpack permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install dotenv-webpack&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i dotenv-webpack&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;nextconfigjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#nextconfigjs&quot; aria-label=&quot;nextconfigjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;next.config.js&lt;/h2&gt;&lt;p&gt;Depending on how NODE_ENV is configured, your app will use &lt;code&gt;.env.development&lt;/code&gt; or &lt;code&gt;.env.production&lt;/code&gt;. Be sure to restart the server after changes.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/next.config.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Dotenv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;dotenv-webpack&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nextConfig &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;webpack&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Dotenv&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;./.env.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;          process&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;NODE_ENV&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation string&quot;&gt;&amp;quot;production&amp;quot;&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation string&quot;&gt;&amp;quot;production&amp;quot;&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation string&quot;&gt;&amp;quot;development&amp;quot;&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; config&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nextConfig&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;div title=&quot;next.config.js if you&amp;#x27;re using withSass()&quot;&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/next.config.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; withSass &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;@zeit/next-sass&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Dotenv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;dotenv-webpack&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nextConfig &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;webpack&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;plugins&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Dotenv&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;./.env.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;          process&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;NODE_ENV&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation string&quot;&gt;&amp;quot;production&amp;quot;&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation string&quot;&gt;&amp;quot;production&amp;quot;&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation string&quot;&gt;&amp;quot;development&amp;quot;&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; config&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;withSass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;nextConfig&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;For example, you can define &lt;code&gt;NODE_ENV&lt;/code&gt; as production inside &lt;code&gt;package.son&lt;/code&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dev&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;nodemon -w _server _server/server.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;NODE_ENV=production node _server/server.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Next.js]: How to set up Express.js with Next.js]]></title><description><![CDATA[Install Express.js Creating server package.json Make the following changes to run the server. If you have  nodemon  you can configure like…]]></description><link>https://ellismin.com/2020/05/next-express/</link><guid isPermaLink="false">https://ellismin.com/2020/05/next-express/</guid><pubDate>Mon, 11 May 2020 00:00:01 GMT</pubDate><content:encoded>&lt;h3 id=&quot;install-expressjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-expressjs&quot; aria-label=&quot;install expressjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Express.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i express&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;creating-server&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#creating-server&quot; aria-label=&quot;creating server permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating server&lt;/h2&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/_server/server.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; next &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dev &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;NODE_ENV&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;production&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nextApp &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dev &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; handle &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nextApp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getRequestHandler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Router (Example)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userRoutes &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./routes/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;nextApp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;prepare&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Example: Register routes&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userRoutes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Rendering page per request&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Listening on port &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;packagejson&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#packagejson&quot; aria-label=&quot;packagejson permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;package.json&lt;/h2&gt;&lt;p&gt;Make the following changes to run the server.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/package.json&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dev&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node _server/server.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node _server/server.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;^4.17.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you have &lt;code&gt;nodemon&lt;/code&gt; you can configure like this:&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/package.json&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dev&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;nodemon -w _server _server/server.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node _server/server.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;^4.17.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;You can install &lt;code&gt;nodemon&lt;/code&gt;, if not previously installed with &lt;code&gt;npm i -D nodemon&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;nodemon -w _server _server/server.js&lt;/code&gt; watches for the changes in &lt;code&gt;_server&lt;/code&gt; directory and starts &lt;code&gt;_server/server.js&lt;/code&gt; file&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;extra-add-cors-header--error-handler--mongoose-connection-to-server&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#extra-add-cors-header--error-handler--mongoose-connection-to-server&quot; aria-label=&quot;extra add cors header  error handler  mongoose connection to server permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extra: Add CORS header &amp;amp; Error Handler &amp;amp; Mongoose connection to server&lt;/h2&gt;&lt;h3 id=&quot;install-mongoose&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-mongoose&quot; aria-label=&quot;install mongoose permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Mongoose&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i mongoose&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;configure-mongoose-uri&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#configure-mongoose-uri&quot; aria-label=&quot;configure mongoose uri permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configure Mongoose URI&lt;/h3&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/_server/config.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;mongodb+srv://&amp;lt;DB_USERNAME&amp;gt;:&amp;lt;PASSWORD&amp;gt;@cluster0-xc4db.mongodb.net/test&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/_server/config.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; next &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dev &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;NODE_ENV&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;production&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nextApp &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dev &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; handle &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nextApp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getRequestHandler&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mongoose&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./config&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Router (Example)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userRoutes &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./routes/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;nextApp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;prepare&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set CORS header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-control-Allow-Origin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Methods&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;GET, POST, DELETE, PUT, OPTIONS&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Allow client to set headers with Content-Type&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Headers&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Example: Register routes&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userRoutes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Rendering page per request&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Error Handler&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; status &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Passing original error data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// DB connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  mongoose&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useNewUrlParser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useUnifiedTopology&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useFindAndModify&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; server &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Listening on port &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Next.js]: Build page transitions with React Transition Group in Next.js]]></title><description><![CDATA[Overview In this post I'll show how to apply page transitions (a.k.a. route transitions or page animations) in  Next.js  with  React…]]></description><link>https://ellismin.com/2020/05/next-page-transition/</link><guid isPermaLink="false">https://ellismin.com/2020/05/next-page-transition/</guid><pubDate>Mon, 11 May 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;In this post I&amp;#x27;ll show how to apply page transitions (a.k.a. route transitions or page animations) in &lt;strong&gt;Next.js&lt;/strong&gt; with &lt;strong&gt;React Transition Group&lt;/strong&gt;. I&amp;#x27;ll be using &lt;code&gt;Layout&lt;/code&gt; component to target specific component to apply the animation.&lt;/p&gt;&lt;p&gt;Here is &lt;a href=&quot;https://github.com/EllisMin/next.js-page-transition&quot;&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;//opt/buildhome/repo/_posts/1b1a802f77c54df99d33cdf0ef16cd16/demo.gif&quot;/&gt;&lt;/p&gt;&lt;h3 id=&quot;install-react-transition-group&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-react-transition-group&quot; aria-label=&quot;install react transition group permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install react-transition-group&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i react-transition-group&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;layout&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#layout&quot; aria-label=&quot;layout permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Layout&lt;/h3&gt;&lt;p&gt;Start by creating &lt;code&gt;Layout&lt;/code&gt; component. Header is a tag that won&amp;#x27;t animate, but later transition will be applied to main container.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Layout/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./styles.scss&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; children &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Header component that doesn&amp;#x27;t animate */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;transition&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#transition&quot; aria-label=&quot;transition permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Transition&lt;/h3&gt;&lt;p&gt;This transition will fade out to the left and fade in from the right with the changes in &lt;code&gt;opacity&lt;/code&gt; and &lt;code&gt;translateX()&lt;/code&gt; values.&lt;/p&gt;&lt;p&gt;This component needs &lt;code&gt;location&lt;/code&gt; prop to be used as key property, so it can keep track of which component is coming in and out. &lt;code&gt;location&lt;/code&gt; will be passed down from &lt;code&gt;Layout&lt;/code&gt; component that will use &lt;code&gt;useRoute&lt;/code&gt; function provided by Next.js&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Transition/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token imports&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;TransitionGroup&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token imports&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Transition&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports keyword module&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;ReactTransition&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-transition-group&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; getTransitionStyles &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;entering&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;translateX(50px)&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;entered&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;opacity &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;ms ease-in-out, transform &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;ms ease-in-out&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;translateX(0px)&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;exiting&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;opacity &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;ms ease-in-out, transform &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation constant&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;ms ease-in-out&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;translateX(-50px)&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Transition&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; children&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter dom variable&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;TransitionGroup&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;relative&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;ReactTransition&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript dom variable&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;timeout&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;enter&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript constant&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript constant&quot;&gt;TIMEOUT&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;getTransitionStyles&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;ReactTransition&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;TransitionGroup&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Transition&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;layout-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#layout-1&quot; aria-label=&quot;layout 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Layout&lt;/h3&gt;&lt;p&gt;With &lt;code&gt;Transition&lt;/code&gt; component created, wrap the main container and pass down &lt;code&gt;location&lt;/code&gt; with its pathname.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Layout/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useRouter &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next/router&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Transition&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../Transition&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./styles.scss&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; children &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useRouter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Header component that doesn&amp;#x27;t animate */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Transition&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Transition&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;layout-styling&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#layout-styling&quot; aria-label=&quot;layout styling permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Layout Styling&lt;/h3&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Layout/styles.scss&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-scss&quot;&gt;SCSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-scss&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.layout &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-direction&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;680&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#eaeaea&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; hidden&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.main &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ddd&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;pages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#pages&quot; aria-label=&quot;pages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Pages&lt;/h2&gt;&lt;p&gt;In order to navigate to different pages, create &lt;code&gt;HomePage&lt;/code&gt; and &lt;code&gt;AboutPage&lt;/code&gt; as an example&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/pages/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next/link&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;HomePage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;HomePage&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;about&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Link To About&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;HomePage&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/pages/about.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;next/link&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;AboutPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;AboutPage&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Link To Home&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;AboutPage&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;_appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#_appjs&quot; aria-label=&quot;_appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;_app.js&lt;/h3&gt;&lt;p&gt;To apply &lt;code&gt;Layout&lt;/code&gt; across different page, you need to wrap the &lt;code&gt;Component&lt;/code&gt; (pages) inside &lt;code&gt;_app.js&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/pages/_app.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../components/Layout&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter maybe-class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; pageProps&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; router &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag spread punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token tag spread&quot;&gt;pageProps&lt;/span&gt;&lt;span class=&quot;token tag spread punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;thats-it&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#thats-it&quot; aria-label=&quot;thats it permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;That&amp;#x27;s it!&lt;/h3&gt;&lt;p&gt;After making changes to &lt;code&gt;_app.js&lt;/code&gt;, be sure to restart the server for it to take effect&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Next.js]: Set up Sass/Scss environment with Next.js]]></title><description><![CDATA[Install next-sass & node-sass Create  next.config.js  in the root directory & import After saving the file, you need to  restart the server…]]></description><link>https://ellismin.com/2020/05/next-sass/</link><guid isPermaLink="false">https://ellismin.com/2020/05/next-sass/</guid><pubDate>Sun, 10 May 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;install-next-sass--node-sass&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-next-sass--node-sass&quot; aria-label=&quot;install next sass  node sass permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install next-sass &amp;amp; node-sass&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i @zeit/next-sass node-sass&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-nextconfigjs-in-the-root-directory--import&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-nextconfigjs-in-the-root-directory--import&quot; aria-label=&quot;create nextconfigjs in the root directory  import permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create &lt;code&gt;next.config.js&lt;/code&gt; in the root directory &amp;amp; import&lt;/h3&gt;&lt;p&gt;After saving the file, you need to &lt;strong&gt;restart the server&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/next.config.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; withSass &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;@zeit/next-sass&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;withSass&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;styling&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#styling&quot; aria-label=&quot;styling permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Styling&lt;/h3&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Button/styles.scss&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-scss&quot;&gt;SCSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-scss&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.custom-button &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pointer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Button/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./styles.scss&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; children &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;custom-button&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Button&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React]: Use global state with React Hook and Context]]></title><description><![CDATA[TL;DR Scroll down to  1. Set up Context  for code snippets Overview In React, passing down state to child components can be tedious…]]></description><link>https://ellismin.com/2020/04/react-context/</link><guid isPermaLink="false">https://ellismin.com/2020/04/react-context/</guid><pubDate>Wed, 29 Apr 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;tldr&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#tldr&quot; aria-label=&quot;tldr permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;TL;DR&lt;/h2&gt;&lt;p&gt;Scroll down to &lt;a href=&quot;/2020/04/react-context/#1-set-up-context&quot;&gt;1. Set up Context&lt;/a&gt; for code snippets&lt;/p&gt;&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;In React, passing down state to child components can be tedious, especially when you have to share state with a &amp;quot;grand child&amp;quot; component i.e. performing a &amp;quot;prop drilling&amp;quot;, or when you need to share a state with number of child components. This is when React &lt;code&gt;Context&lt;/code&gt; may be handy. &lt;code&gt;Context&lt;/code&gt; provides a way to pass data through component tree without having to pass them manually. This post will show how to pass it along with &lt;code&gt;React hooks&lt;/code&gt;.&lt;/p&gt;&lt;h3 id=&quot;why-you-might-need-global-state-to-avoid-prop-drilling&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#why-you-might-need-global-state-to-avoid-prop-drilling&quot; aria-label=&quot;why you might need global state to avoid prop drilling permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why you might need global state: to avoid prop drilling&lt;/h3&gt;&lt;p&gt;In case where &lt;code&gt;GrandChild&lt;/code&gt; component needs a prop that needs to trickle all the way down from parent component, it&amp;#x27;d be a bad practice to manually pass it down. It would be even worse if &lt;code&gt;Child1&lt;/code&gt; and &lt;code&gt;Child2&lt;/code&gt; don&amp;#x27;t need the &lt;code&gt;&amp;quot;drilledProp&amp;quot;&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../Parent/index&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../GrandChild&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Child2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; drilledProp &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;drilledProp&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;drilledProp&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Child1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; drilledProp &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Child2&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;drilledProp&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;drilledProp&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;someState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Child1&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;drilledProp&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;someState&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;file-structure-for-this-post&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#file-structure-for-this-post&quot; aria-label=&quot;file structure for this post permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;File structure for this post&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;├── components&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   ├── App&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   |   └── index.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   ├── Parent&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   |   └── index.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   └── GrandChild&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       └── index.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;├── contexts&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   └── user-context.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;└── hooks&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    └── use-user.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;scenario&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#scenario&quot; aria-label=&quot;scenario permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Scenario&lt;/h2&gt;&lt;p&gt;Consider a situation where you have a parent component i.e. App component or Layout component, and you would like to pass down its state and/or set state function to a &amp;quot;grand child&amp;quot; component that is located far down in a virtual DOM tree. Or you would like to pass down to many children components.&lt;/p&gt;&lt;p&gt;As an example, in a &lt;code&gt;Parent&lt;/code&gt; component, you want to pass &lt;code&gt;user&lt;/code&gt; state and &lt;code&gt;setUser&lt;/code&gt; function to a grand child component.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Parent/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; children &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Jon&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div className&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;parent&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Parent&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And inside &lt;code&gt;GrandChild&lt;/code&gt; component, you want to use the &lt;code&gt;users&lt;/code&gt; property that was pass from far above in component tree.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/component/GrandChild/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;1-set-up-context&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-set-up-context&quot; aria-label=&quot;1 set up context permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Set up Context&lt;/h2&gt;&lt;p&gt;Setting up context is simple. &lt;code&gt;UserContext&lt;/code&gt; will later contain &lt;code&gt;user&lt;/code&gt; state and &lt;code&gt;setUser&lt;/code&gt; function when it&amp;#x27;s passed down to a child component&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/contexts/user-context.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; createContext &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserContext&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createContext&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;2-set-up-hooks&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-set-up-hooks&quot; aria-label=&quot;2 set up hooks permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Set up hooks&lt;/h2&gt;&lt;p&gt;This hook utilizes the context above and helps to retrieve the state in child components. The function will later be called with &lt;code&gt;const { user, setUser } = useUser()&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/hooks/use-user.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useContext &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;UserContext&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../contexts/user-context&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;useUser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useContext&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserContext&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    setUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;3-contextprovider&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-contextprovider&quot; aria-label=&quot;3 contextprovider permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Context.Provider&lt;/h2&gt;&lt;p&gt;Now, you&amp;#x27;ll need a way to pass the data from the parent component and determine which data to pass in. Use the &lt;code&gt;&amp;lt;UserContext.Provider&amp;gt;&lt;/code&gt; to wrap it around your child component. &lt;code&gt;Provider&lt;/code&gt; comes with &lt;code&gt;Context&lt;/code&gt; object, and it allows multiple components to &amp;quot;consume&amp;quot; to subscribe to context changes. It can trickle deep within the component tree.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/Parent/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;UserContext&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../../contexts/user-context&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; children &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Jon&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;parent&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;UserContext.Provider&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; setUser&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;UserContext.Provider&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Parent&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;4-consume-the-passed-state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-consume-the-passed-state&quot; aria-label=&quot;4 consume the passed state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Consume the passed state&lt;/h2&gt;&lt;p&gt;This is where you use &lt;code&gt;useUser&lt;/code&gt; hook to &amp;quot;consume&amp;quot; the state stored in &lt;code&gt;UserContext&lt;/code&gt; which was passed from &lt;code&gt;Parent&lt;/code&gt; component.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/components/GrandChild/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useUser &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../../hooks/use-user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;user &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;5-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-appjs&quot; aria-label=&quot;5 appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. App.js&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Parent&lt;/code&gt; component uses &lt;code&gt;children&lt;/code&gt; prop, so it assumes that &lt;code&gt;Parent&lt;/code&gt; and &lt;code&gt;GrandChild&lt;/code&gt; are rendered elsewhere. Here&amp;#x27;s an example.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/component/App/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../Parent/index&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../GrandChild&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;GrandChild&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React + Node.js]: Create Messenger App with MERN Stack + Socket.io]]></title><description><![CDATA[Overview This post explains how to build a basic real-time messenger application with MERN (MongoDB, Express.js, React, Node.js) Stack…]]></description><link>https://ellismin.com/2020/04/mern-chat/</link><guid isPermaLink="false">https://ellismin.com/2020/04/mern-chat/</guid><pubDate>Wed, 22 Apr 2020 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:43.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAJABQDASIAAhEBAxEB/8QAFwAAAwEAAAAAAAAAAAAAAAAAAAIDBf/EABcBAAMBAAAAAAAAAAAAAAAAAAACAwX/2gAMAwEAAhADEAAAAb57RpoAgp//xAAYEAEAAwEAAAAAAAAAAAAAAAABAAIQA//aAAgBAQABBQJrzY47/8QAFhEBAQEAAAAAAAAAAAAAAAAAARBB/9oACAEDAQE/AQTZ/8QAFREBAQAAAAAAAAAAAAAAAAAAARD/2gAIAQIBAT8BZ//EABUQAQEAAAAAAAAAAAAAAAAAACAy/9oACAEBAAY/AqX/xAAbEAACAQUAAAAAAAAAAAAAAAAAAREQIUFRgf/aAAgBAQABPyFBj0e7jZNDGf/aAAwDAQACAAMAAAAQGN//xAAWEQEBAQAAAAAAAAAAAAAAAAAAETH/2gAIAQMBAT8Q1KV//8QAFhEBAQEAAAAAAAAAAAAAAAAAARBB/9oACAECAQE/EAmz/8QAGRABAAMBAQAAAAAAAAAAAAAAAQARMSFR/9oACAEBAAE/ELiFcuxyDUrBA+l7HqZJuan/2Q==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;messages&quot; title=&quot;messages&quot; src=&quot;/static/750b90336e11e5f76b04c36332ba6913/8d3e2/messages.jpg&quot; srcSet=&quot;/static/750b90336e11e5f76b04c36332ba6913/34fa0/messages.jpg 215w,/static/750b90336e11e5f76b04c36332ba6913/40c27/messages.jpg 430w,/static/750b90336e11e5f76b04c36332ba6913/8d3e2/messages.jpg 860w,/static/750b90336e11e5f76b04c36332ba6913/6a068/messages.jpg 960w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;This post explains how to build a basic real-time messenger application with MERN (MongoDB, Express.js, React, Node.js) Stack + Socket.io.&lt;/p&gt;&lt;h2 id=&quot;demo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#demo&quot; aria-label=&quot;demo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Demo&lt;/h2&gt;&lt;p&gt;Left and right screens are to demonstrate different clients by using differnet browsers.&lt;/p&gt;&lt;p&gt;Try it yourself &lt;a href=&quot;http://ellis-chat.herokuapp.com/&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&lt;div style=&quot;display:flex;max-width:530px;margin:1rem auto&quot;&gt;
  &lt;img src=&quot;//opt/buildhome/repo/_posts/9c66c159bd76e589a2a503492ad2ef5d/demo.gif&quot; style=&quot;max-width:100%&quot;/&gt;&lt;/div&gt;&lt;h2 id=&quot;prerequisite&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#prerequisite&quot; aria-label=&quot;prerequisite permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Prerequisite&lt;/h2&gt;&lt;p&gt;If you don&amp;#x27;t have a MERN Stack application set up, &lt;a href=&quot;https://github.com/EllisMin/mern-custom&quot;&gt;here&lt;/a&gt; is a starter that you can clone.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;clone&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; clone https://github.com/EllisMin/mern-custom.git ~/YOUR_FOLDER/messenger-app&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Install dependencies (Server &amp;amp; Client)&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/YOUR_FOLDER/messenger-app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; run install-both&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Install Extra dependencies needed for this project&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Front-end:&lt;/strong&gt; React Bootstrap | Socket.io Client | Fontawesome&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i react-bootstrap bootstrap socket.io-client react-timeago @fortawesome/fontawesome-svg-core @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Back-end:&lt;/strong&gt; Socket.io | GeoIP-lite | express-useragent | express-validator | express-rate-limit&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i socket.io geoip-lite express-useragent express-validator express-rate-limit&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Both at once&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i react-bootstrap bootstrap socket.io-client react-timeago @fortawesome/fontawesome-svg-core @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons socket.io geoip-lite express-useragent express-validator express-rate-limit&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;server-side&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#server-side&quot; aria-label=&quot;server side permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Server side&lt;/h2&gt;&lt;h3 id=&quot;mongodb-uri&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#mongodb-uri&quot; aria-label=&quot;mongodb uri permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MongoDB URI&lt;/h3&gt;&lt;p&gt;Update the MongoDB URI to yours&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;config.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;mongodb+srv://&amp;lt;DB_USERNAME&amp;gt;:&amp;lt;PASSWORD&amp;gt;@cluster0-abcde.mongodb.net/test&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;socket-util&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#socket-util&quot; aria-label=&quot;socket util permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Socket util&lt;/h3&gt;&lt;p&gt;This fils is used to share socket io instance across different files.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/utils/socket.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;httpServer&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;socket.io&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;httpServer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;getIO&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Socket.io is not initialized&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-message-schema&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-message-schema&quot; aria-label=&quot;create message schema permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create message schema&lt;/h3&gt;&lt;p&gt;I&amp;#x27;ll allow a public user or a visitor to join the messenger. So, each message on client side will display partial IP address i.e. &lt;code&gt;(11.222)&lt;/code&gt; as well as user&amp;#x27;s current time zone. i.e. &lt;code&gt;America/Chicago&lt;/code&gt; with the help of &lt;code&gt;geoip-lite&lt;/code&gt; package.&lt;/p&gt;&lt;p&gt;To limit the number of post request from the public users, &lt;code&gt;ip&lt;/code&gt;, &lt;code&gt;platform&lt;/code&gt;, and &lt;code&gt;os&lt;/code&gt; will be used to check for the same device under same ip address. Checking the same &lt;code&gt;ip&lt;/code&gt; may not be sufficient as multiple devices may be used under the same external ip addresses. Although this is not a perfect solution, I&amp;#x27;ve decided to check for the &lt;code&gt;platform&lt;/code&gt;, i.e. &lt;code&gt;Apple Mac&lt;/code&gt; and &lt;code&gt;os&lt;/code&gt;, i.e. &lt;code&gt;macOS Mojave&lt;/code&gt; provided with &lt;code&gt;express-useragent&lt;/code&gt; package.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/models/message.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;mongoose&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access maybe-class-name&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageSchema &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;partialIp&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;timestamps&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageSchema&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-controller&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-controller&quot; aria-label=&quot;create controller permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create controller&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Imports&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/controllers/message.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; geoip &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;geoip-lite&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../utils/socket&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../models/message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Get messages&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;This method retrieves the latest 10 messages and send to the client.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/controllers/message.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;getMessages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Get last(latest) 10 messages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messages &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;-updatedAt -__v -_id&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Failed to fetch messages&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Fetched messages&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Post message&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;When a client requests to post a message, this function &lt;div&gt;looks up how many messages user has posted for the past 3 minutes to limit the request.&lt;/div&gt; Also it removes the oldest message from database when it reaches limit.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/controllers/message.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;postMessage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Retrieve IP from the header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ip &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;x-forwarded-for&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;remoteAddress&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;,&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ip &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;substring&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;,&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Retrieve partial IP from ip. i.e. 111.22&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; partialIp &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; splittedIps &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;.&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;splittedIps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;splittedIps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    partialIp &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; splittedIps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    partialIp &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;splittedIps&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token template-string interpolation number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;splittedIps&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token template-string interpolation number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Get timezone from ip address. When not found, set default to prevent error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; geo &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; geoip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;lookup&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;geo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      geo &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;isBot&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Failed to get message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Bot check&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;geo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; geo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;isBot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Failed to post&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Query messages created last 3 minutes to check for # request limit&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; recentMessages &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;$gt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ipMatchCount &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; platformMatchCount &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Check if there are multiple entries with same ip &amp;amp; device&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    recentMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        ipMatchCount&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          m&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          m&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;useragent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          m&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;useragent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          platformMatchCount&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Limit requests with same ip and device to 10 or same ip to 20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ipMatchCount &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; platformMatchCount &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      ipMatchCount &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Message limit reached&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Optional: When number of messages reaches the limit (50), it removes the oldest message */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; totalMessages &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;countDocuments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;totalMessages &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; oldestMessage &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;oldestMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Couldn&amp;#x27;t find message to remove&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;findByIdAndRemove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;oldestMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageDoc &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;agent&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;isBot&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;useragent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;isBot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;useragent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;useragent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;partialIp&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; partialIp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; geo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageDoc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Object to pass to socket.io client&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message_ &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;partialIp&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageDoc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;partialIp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; geo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageDoc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sends message to all connected users&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getIO&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message event&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;add&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;message_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;_doc&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;201&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Message created&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-route&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-route&quot; aria-label=&quot;create route permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create route&lt;/h3&gt;&lt;p&gt;&lt;code&gt;express-validator&lt;/code&gt; validates the input passed in &lt;code&gt;req.body&lt;/code&gt;. Character limit is between 1 and 100.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;routes/code.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;express&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; body &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;express-validator&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageController &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../controllers/message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// GET /messages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;/messages&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;getMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// POST /message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;/message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;isLength&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  messageController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;postMessage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-controller-for-socketio&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-controller-for-socketio&quot; aria-label=&quot;create controller for socketio permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create controller for socket.io&lt;/h3&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/controllers/socket.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;setUpIOConnection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../utils/socket&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;connection&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;init&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle disconnect&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;disconnect&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Remove user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; index &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          index &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Remove user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;index &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;splice&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;init&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div padding=&quot;1rem&quot;&gt;&lt;div title=&quot;Click to learn more about socket functions&quot;&gt;&lt;h2 id=&quot;socketemit-vs-socketbroadcastemit-vs-ioemit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#socketemit-vs-socketbroadcastemit-vs-ioemit&quot; aria-label=&quot;socketemit vs socketbroadcastemit vs ioemit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;socket.emit() vs socket.broadcast.emit() vs io.emit()&lt;/h2&gt;&lt;p&gt;I have used &lt;code&gt;io.emit()&lt;/code&gt; in above code which emits information to &lt;div&gt;all of the clients&lt;/div&gt; as &lt;code&gt;io&lt;/code&gt; variable represents the group of sockets.&lt;/p&gt;&lt;p&gt;On the other hand, when you want to deal with communicating with &lt;strong&gt;each individual connection&lt;/strong&gt;, you can use &lt;code&gt;socket&lt;/code&gt; variable which is available in each connection.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;socket.emit()&lt;/strong&gt;: Emit information &lt;div&gt;to a single client&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;socket.broadcast.emit()&lt;/strong&gt;: Emit information to &lt;div&gt;all clients except client that&amp;#x27;s connecting&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;io.emit()&lt;/strong&gt;: Emit information to &lt;div&gt;all clients&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;Example&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;connection&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Emit information to SINGLE CLIENT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Welcome to the chat&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Emit information to ALL CLIENTS EXCEPT CLIENT that&amp;#x27;s connecting&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;broadcast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;new user has joined the chat&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;disconnect&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Emit information too ALL CLIENTS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;A user has left the chat&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;more-examples&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-examples&quot; aria-label=&quot;more examples permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More examples&lt;/h3&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;socket_functions&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to sender-client only&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;this is a test&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to all clients except sender&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;broadcast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;this is a test&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to all clients in &amp;#x27;game&amp;#x27; room(channel) except sender&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;broadcast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;game&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;nice game&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to sender client, only if they are in &amp;#x27;game&amp;#x27; room(channel)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;game&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;enjoy the game&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to individual socketid&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;broadcast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;socketid&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;for your eyes only&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to all clients, include sender&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;this is a test&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to all clients in &amp;#x27;game&amp;#x27; room(channel), include sender&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;game&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;cool game&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sending to all clients in namespace &amp;#x27;myNamespace&amp;#x27;, include sender&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;of&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;myNamespace&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;gg&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Send to all connected clients&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Send to all connected clients except the one that sent the message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;broadcast&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Event listener, can be called on client to execute on server&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// For emitting to specific clients&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;sockets&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Send to all connected clients (same as socket.emit)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;sockets&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Initial connection from a client.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;sockets&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Reference: &lt;a href=&quot;https://stackoverflow.com/questions/32674391/io-emit-vs-socket-emit&quot;&gt;stackoverflow&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;h3 id=&quot;appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#appjs&quot; aria-label=&quot;appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;app.js&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;useragent&lt;/code&gt;: used to parses user-agent inside header to retrieve &lt;code&gt;platform&lt;/code&gt; and &lt;code&gt;os&lt;/code&gt; information. It will be accessible in &lt;code&gt;req.useragent&lt;/code&gt; which is used in controller&lt;/li&gt;&lt;li&gt;&lt;code&gt;rateLimit&lt;/code&gt;: used to limit number of requests&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/app.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;dotenv&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;path&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;express&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;mongoose&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; useragent &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;express-useragent&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; rateLimit &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;express-rate-limit&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./config&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; messageRoutes &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./routes/message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUpIOConnection &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./controllers/socket&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;useragent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set up rate limiter for entire app requests&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; appLimiter &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;rateLimit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;windowMs&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// 15 minutes&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;150&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// limit each IP # requests per windowMs&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;appLimiter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Serves mern-demo/client/build statically&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;client&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;build&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set CORS header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Access-control-Allow-Origin&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;*&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Access-Control-Allow-Methods&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;GET, POST, DELETE, PUT, OPTIONS&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Set-Cookie&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;HttpOnly;Secure;SameSite=Strict&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Allow client to set headers with Content-Type&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Access-Control-Allow-Headers&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Content-Type&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Register routes&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;messageRoutes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;sendFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;client&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;build&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;index.html&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Error Handler&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; status &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Passing original error data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// DB connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mongoose&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useNewUrlParser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useUnifiedTopology&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useFindAndModify&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; server &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Listening on port &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUpIOConnection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;client-side--creating-views&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#client-side--creating-views&quot; aria-label=&quot;client side  creating views permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Client side – Creating views&lt;/h2&gt;&lt;p&gt;Create &lt;code&gt;Chat&lt;/code&gt; directory under &lt;code&gt;Components&lt;/code&gt; as well as children files:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;└── client&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    └── src&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        └── Components&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            ├── Chat&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            |   ├── ChatIcon&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            |   |   └── index.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            |   |       └── styles.scss&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            |   ├── ChatModal&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            |   |   ├── index.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            |   |   └── styles.scss&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            |   └── index.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            └── ...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Set default exports for &lt;code&gt;ChatIcon&lt;/code&gt; and &lt;code&gt;ChatModal&lt;/code&gt; inside &lt;code&gt;Chat/index.js&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../Chat/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports keyword module&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports maybe-class-name&quot;&gt;ChatIcon&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./ChatIcon&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports keyword module&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports maybe-class-name&quot;&gt;ChatModal&lt;/span&gt;&lt;span class=&quot;token exports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token exports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./ChatModal&amp;#x27;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;chaticon&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#chaticon&quot; aria-label=&quot;chaticon permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ChatIcon&lt;/h3&gt;&lt;p&gt;In &lt;code&gt;ChatIcon&lt;/code&gt; component, &lt;code&gt;userCount&lt;/code&gt; and &lt;code&gt;toggleShowChat&lt;/code&gt; will be passed down from &lt;code&gt;App&lt;/code&gt; component later&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../Chat/ChatIcon/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;FontAwesomeIcon&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;@fortawesome/react-fontawesome&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; faCommentDots &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;@fortawesome/free-solid-svg-icons&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./styles.scss&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;ChatIcon&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userCount&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; toggleShowChat &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-icon-container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;FontAwesomeIcon&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;icon-fa icon-comment-dots&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;faCommentDots&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-icon-user-count disable-selection&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;chat(&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;userCount&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ChatIcon&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add &lt;code&gt;ChatIcon&lt;/code&gt; Styling&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../Chat/ChatIcon/styles.scss&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-scss&quot;&gt;SCSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-scss&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-icon-container &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pointer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fixed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;:hover &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.icon-comment-dots &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.icon-comment-dots &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ea4334&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-icon-user-count &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;translateX&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;-50&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.7&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;app&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#app&quot; aria-label=&quot;app permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;App&lt;/h3&gt;&lt;p&gt;Import &lt;code&gt;ChatIcon&lt;/code&gt; inside &lt;code&gt;App&lt;/code&gt; and create state to toggle showing/hiding the chat&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;App/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../Header&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;ChatIcon&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;ChatModal&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../Chat&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./styles.scss&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;showChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setShowChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setShowChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;showChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Messenger App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;ChatIcon&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In &lt;code&gt;App/styles.scss&lt;/code&gt;, add relative position and import bootstrap&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;App/styles.scss&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-scss&quot;&gt;SCSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-scss&quot;&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;@import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;~bootstrap/scss/bootstrap&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;@import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../Shared/config&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;@import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../Shared/util&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.App &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; relative&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point, your app should have a fixed positioned chat icon available on your app&lt;/p&gt;&lt;h3 id=&quot;chatmodal&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#chatmodal&quot; aria-label=&quot;chatmodal permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ChatModal&lt;/h3&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;ChatModal/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useRef&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;FontAwesomeIcon&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;@fortawesome/react-fontawesome&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token imports&quot;&gt;  faWindowMinimize&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token imports&quot;&gt;  faEllipsisH&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token imports&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;@fortawesome/free-solid-svg-icons&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;InputGroup&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;FormControl&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports keyword module&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Btn&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react-bootstrap&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;TimeAgo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react-timeago&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../../../constants&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../../Button&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Alert&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../../Alert&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./styles.scss&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;ChatModal&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; toggleShowChat&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; userCount&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; messages &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;sendLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setSendLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setError&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword nil&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; scrollDivRef &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useRef&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; inputRef &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useRef&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;scrollToBottom&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    scrollDivRef&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;current&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;scrollIntoView&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;behavior&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;auto&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Scroll to bottom when messages change&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;scrollToBottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; value &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; rowCount &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;\n&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Character limit &amp;amp; row limit&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CHAR_LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      rowCount &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;TEXTAREA_MAX_ROWS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      value &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;\n&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Submit on enter in textarea. Shift + enter still valid to type newline&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleKeyPress&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Submit if enter was pressed without shift&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Enter&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;shiftKey&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Prevents newline&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CHAR_LIMIT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setSendLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;/message&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;POST&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token string-property property&quot;&gt;&amp;#x27;Content-Type&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;application/json&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;You&amp;#x27;re typing too fast! Please try again soon&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;201&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Failed to post&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Clear input field&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setSendLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setError&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setMessage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setSendLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-modal&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-main&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-delay-show&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-header&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;icon-container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;disabled&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;iconBtn&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;FontAwesomeIcon&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt;icon-ellipsis-h&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;faEllipsisH&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-header-text&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Chat with others! (&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;userCount&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;icon-container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;iconBtn&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;FontAwesomeIcon&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt;icon-window-minimize&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;faWindowMinimize&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-content-inner&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Alert&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClose&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript function&quot;&gt;setError&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword nil&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                messages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;message-container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;message-sender&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;message-sender-location&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;partialIp&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;                          m&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string string&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string interpolation&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string interpolation property-access&quot;&gt;timezone&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string string&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;                        &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;message-sender-time&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;TimeAgo&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;message-block&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Loader&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;scrollDivRef&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;chat-input-container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;InputGroup&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;mb-2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;sm&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;FormControl&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;textarea&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;rows&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript constant&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript constant&quot;&gt;TEXTAREA_MAX_ROWS&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;maxLength&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript constant&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript constant&quot;&gt;CHAR_LIMIT&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Text Message&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;aria-label&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Text Message&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;aria-describedby&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;basic-addon2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onKeyPress&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleKeyPress&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;inputRef&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;InputGroup.Append&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Btn&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;variant&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;outline-secondary&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;disabled&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;sendLoading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                    Send&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Btn&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;InputGroup.Append&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;InputGroup&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ChatModal&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;{ MESSAGE }&lt;/code&gt; comes from the following file. It specifies the character limit (for the client side!) and the maximum number of rows for the textarea.&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;.../src/constants/enum.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MESSAGE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;CHAR_LIMIT&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;TEXTAREA_MAX_ROWS&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add styling for &lt;code&gt;ChatModal&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;ChatModal/styles.scss&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;scss&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-scss&quot;&gt;SCSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-scss&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token property variable&quot;&gt;$chat-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;320&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token property variable&quot;&gt;$chat-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;620&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-modal &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fixed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-main &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$chat-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$chat-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#f7f7f7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#aaa&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; expand &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;250&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;ms&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ease-in&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-delay-show &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; relative&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-direction&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; hidden&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; delayShow &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;ms&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; forwards &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;350&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;ms&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-header &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; space-between&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;align-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-top-left-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-top-right-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;-text &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.icon-container &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.icon-window-minimize &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token selector parent important&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;:hover &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.icon-ellipsis-h &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ddd&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-content &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; block&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; relative&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pre-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;word-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; break-word&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-content-inner &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;overflow-y&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;transparent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;overscroll-behavior&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; contain&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.message-container &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-direction&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ddd&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.message-sender &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; space-between&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;span &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.7&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin-left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#555&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.message-block &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.6&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#eee&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.8&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fadeInMessage &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;800&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;ms&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ease-in&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.alert-custom &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; sticky&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.chat-input-container &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#fbfaff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.btn-outline-secondary &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#cbc7e6&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.btn:hover &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#e7f2ff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;.form-control &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token important&quot;&gt;!important&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;textarea &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;resize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token atrule rule&quot;&gt;@keyframes&lt;/span&gt;&lt;span class=&quot;token atrule&quot;&gt; expand&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;to &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$chat-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$chat-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token atrule rule&quot;&gt;@keyframes&lt;/span&gt;&lt;span class=&quot;token atrule&quot;&gt; delayShow&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;to &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token atrule rule&quot;&gt;@keyframes&lt;/span&gt;&lt;span class=&quot;token atrule&quot;&gt; fadeInMessage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#aebaeb&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;to &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;back-to-app&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#back-to-app&quot; aria-label=&quot;back to app permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Back to App&lt;/h3&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;App/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;openSocket&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;socket.io-client&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Alert&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../Alert&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../Header&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;ChatIcon&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;ChatModal&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;../Chat&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;./styles.scss&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;showChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setShowChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setShowChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;showChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;publicUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setPublicUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setError&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createSocketConnection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetchMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;createSocketConnection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; socket &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;openSocket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// init&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;init&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setPublicUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Message events&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;message event&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;add&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;prevMessages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;prevMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;fetchMessages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;/messages&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Failed to fetch messages&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; resData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set reversed 10 messages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;resData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;reverse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setError&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Messenger App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Alert&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClose&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript function&quot;&gt;setError&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;showChat &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;ChatModal&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;userCount&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;publicUsers&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;ChatIcon&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;userCount&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;publicUsers&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;playing-sound-when-sending-or-receiving-message&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#playing-sound-when-sending-or-receiving-message&quot; aria-label=&quot;playing sound when sending or receiving message permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Playing sound when sending or receiving message&lt;/h2&gt;&lt;p&gt;On desktop, setting &lt;code&gt;const [audio] = useState(new Audio(popSoundSrc))&lt;/code&gt; and &lt;code&gt;audio.play()&lt;/code&gt; are just enough to play sound; however, iOS prevents JavaScript &lt;code&gt;play()&lt;/code&gt; and &lt;code&gt;load()&lt;/code&gt; methods. In other words, user must interact with the website first i.e. clicking a button before audio gets played. In this example, we&amp;#x27;ll play muted audio on clicking chat icon to work around this problem. Read more about &lt;a href=&quot;https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW1&quot;&gt;how iOS handles HTML5 Audio and Video&lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;App/index.js&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;popSoundSrc&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../../assets/pop.mp3&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; audioFirstPlayed &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;popSoundSrc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;createSocketConnection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; socket &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;openSocket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// init&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;init&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setPublicUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Message events&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;message event&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;add&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;prevMessages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;prevMessages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;muted&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;muted&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;play&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;toggleShowChat&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;audioFirstPlayed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;muted&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      audio&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;play&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      audioFirstPlayed &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setShowChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;showChat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;possible-enhancements-from-here&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#possible-enhancements-from-here&quot; aria-label=&quot;possible enhancements from here permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Possible enhancements from here&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Queue sending multiple messages&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[Create Gatsby.js]]></title><description><![CDATA[Gatsby  is a static site generator Install Gatsby CLI (Command-line Interface) Create new gatsby app]]></description><link>https://ellismin.com/2020/03/gatsby-1/</link><guid isPermaLink="false">https://ellismin.com/2020/03/gatsby-1/</guid><pubDate>Sun, 22 Mar 2020 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;&quot;&gt;Gatsby&lt;/a&gt; is a static site generator&lt;/p&gt;&lt;h2 id=&quot;install-gatsby-cli-command-line-interface&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-gatsby-cli-command-line-interface&quot; aria-label=&quot;install gatsby cli command line interface permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Gatsby CLI (Command-line Interface)&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i -g gatsby-cli&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;create-new-gatsby-app&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-new-gatsby-app&quot; aria-label=&quot;create new gatsby app permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create new gatsby app&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;gatsby new my-app&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Git + cron]: Schedule your git commands on AWS EC2]]></title><description><![CDATA[Overview Last post,  [Git + launchd]: Schedule your git commands with launchd , covered how to schedule to run sh commands, but it wouldn't…]]></description><link>https://ellismin.com/2020/03/launchd-2/</link><guid isPermaLink="false">https://ellismin.com/2020/03/launchd-2/</guid><pubDate>Sun, 22 Mar 2020 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;Last post, &lt;a href=&quot;/2020/03/launchd-1&quot;&gt;[Git + launchd]: Schedule your git commands with launchd&lt;/a&gt;, covered how to schedule to run sh commands, but it wouldn&amp;#x27;t be as efficient as it cannot run while the PC is asleep/off. Since EC2 instance won&amp;#x27;t hibernate (hopefully), this may be a good place to set up your cron job. In this post, I&amp;#x27;ll explain how to set up cron job on EC2 instance to run a script—git command as an example.&lt;/p&gt;&lt;p&gt;Follow this &lt;a href=&quot;/2020/03/deploy-mern-2/#1-create-ubuntu-aws-ec2-instance&quot;&gt;section of post&lt;/a&gt; to create AWS EC2 instance&lt;/p&gt;&lt;h2 id=&quot;sign-in-to-ec2-instance&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#sign-in-to-ec2-instance&quot; aria-label=&quot;sign in to ec2 instance permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Sign in to EC2 instance&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -i ~/some/dir/aws-key.pem ubuntu@&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;YOUR_PUBLIC_DNS&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;clone-your-project&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#clone-your-project&quot; aria-label=&quot;clone your project permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Clone your project&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Folder structure&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;├── opt&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   ├── cron-test&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   |   └── &amp;lt;YOUR_PROJECT&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   └── script.sh&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;└── ...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Cloning your GitHub Project&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; clone https://github.com/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;GITHUB_USERNAME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;REPO.git&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt/cron-test&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Make changes to your project&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Assume that you&amp;#x27;ve made some changes in your project&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt/cron-test/some_change.html&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;create-script-that-will-run-in-the-future&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-script-that-will-run-in-the-future&quot; aria-label=&quot;create script that will run in the future permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create script that will run in the future&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt/script.sh&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;/opt/script.sh&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt/cron-test&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[RELEASE]: 2.0.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /tmp/commit-log &lt;/span&gt;&lt;span class=&quot;token operator file-descriptor important&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;&amp;amp;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /tmp/push-log &lt;/span&gt;&lt;span class=&quot;token operator file-descriptor important&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;&amp;amp;1&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Save&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Make it executable&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; +x /opt/script.sh&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;check-the-date--time&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#check-the-date--time&quot; aria-label=&quot;check the date  time permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Check the date &amp;amp; time&lt;/h2&gt;&lt;p&gt;Your EC2 instance may not have the same time as the location you&amp;#x27;re at. Use &lt;code&gt;date&lt;/code&gt; to check the time of the machine.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash{outputLines:&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash{outputLines:&quot;&gt;BASH{OUTPUTLINES:&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash{outputLines:&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;date&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Sun Mar 22 07:07:50 CDT 2020&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;set-up-crontab&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#set-up-crontab&quot; aria-label=&quot;set up crontab permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Set up crontab&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;crontab&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -e &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Then select your favorite editor&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;00 &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; * /opt/script.sh&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Minute | Hour | Date | DayOfWeek | Script&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;thats-it&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#thats-it&quot; aria-label=&quot;thats it permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;That&amp;#x27;s it!&lt;/h3&gt;&lt;p&gt;This cron job will executes &lt;code&gt;/opt/script.sh&lt;/code&gt; on 3/22 at 7:00AM every year&lt;/p&gt;&lt;h3 id=&quot;checking-logs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#checking-logs&quot; aria-label=&quot;checking logs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Checking logs&lt;/h3&gt;&lt;p&gt;On linux, cron job gets logged at&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;/var/log/system.log&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the following to filter cron jobs&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;grep CRON /var/log/system.log&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Git + mac]: Schedule your git commands with launchd]]></title><description><![CDATA[launchd In computing,  launchd , a unified operating system service management framework, starts, stops and manages daemons, applications…]]></description><link>https://ellismin.com/2020/03/launchd-1/</link><guid isPermaLink="false">https://ellismin.com/2020/03/launchd-1/</guid><pubDate>Sat, 21 Mar 2020 00:00:03 GMT</pubDate><content:encoded>&lt;h2 id=&quot;launchd&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#launchd&quot; aria-label=&quot;launchd permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;launchd&lt;/h2&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;In computing, &lt;strong&gt;launchd&lt;/strong&gt;, a unified operating system service management framework, starts, stops and manages daemons, applications, processes, and scripts in macOS. It was introduced with Mac OS X Tiger and is licensed under the Apache License — &lt;a href=&quot;https://en.wikipedia.org/wiki/Launchd&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;scenario-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#scenario-example&quot; aria-label=&quot;scenario example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Scenario Example&lt;/h2&gt;&lt;p&gt;You have completed a new release for your project that should be pushed to your GitHub repository at 11:11AM tomorrow. But for some reason, you won&amp;#x27;t be able to be sitting in front of your computer to upload your release. Let&amp;#x27;s see how we can schedule to run a program (script) while you&amp;#x27;re away.&lt;/p&gt;&lt;p&gt;Write a script that needs to be run at a certain time&lt;/p&gt;&lt;p&gt;&lt;strong&gt;~/Desktop/push_release.sh&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/Desktop/project&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[RELEASE]: 1.0.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to create a log file as a result, you can put output to file&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/Desktop/project&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[RELEASE]: 1.0.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /tmp/commit_log &lt;/span&gt;&lt;span class=&quot;token operator file-descriptor important&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;&amp;amp;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /tmp/push_log &lt;/span&gt;&lt;span class=&quot;token operator file-descriptor important&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;&amp;amp;1&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;2&amp;amp;&amp;gt;1&lt;/code&gt; indicates that standard error is redirected to specified file&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;(optional):&lt;/strong&gt; you can choose to make &lt;code&gt;*.sh&lt;/code&gt; executable with &lt;code&gt;chmod +x *.md&lt;/code&gt;, then you won&amp;#x27;t have to specify &lt;code&gt;bash&lt;/code&gt; in ProgramArguments in plist file below.&lt;/p&gt;&lt;h2 id=&quot;create-plist-to-trigger-program-to-run-at-a-specific-time&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-plist-to-trigger-program-to-run-at-a-specific-time&quot; aria-label=&quot;create plist to trigger program to run at a specific time permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create plist to trigger program to run at a specific time&lt;/h2&gt;&lt;p&gt;Make sure to place it under &lt;code&gt;~/Library/LaunchAgents&lt;/code&gt;. &lt;code&gt;~&lt;/code&gt; denotes home directory.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;~/Library/LaunchAgents/com.launchd.example.plist&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token prolog&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype name&quot;&gt;plist&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype name&quot;&gt;PUBLIC&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype string&quot;&gt;&amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot;&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype string&quot;&gt;&amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&lt;/span&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;plist&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Label&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;com.launchd.example&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ProgramArguments&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;bash&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- This line isn&amp;#x27;t required if *.sh is already executable --&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;/Users/Me/Desktop/push_release.sh&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;StartCalendarInterval&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Month&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Day&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Hour&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Minute&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;plist&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Runs &lt;code&gt;bash /Users/Me/Desktop/push_release.sh&lt;/code&gt; on &lt;code&gt;3/22 at 11:11AM&lt;/code&gt;&lt;/p&gt;&lt;p&gt;Please read &lt;a href=&quot;#more-about-launchd&quot;&gt;More about launchd&lt;/a&gt; to learn more details&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;load-launchd&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#load-launchd&quot; aria-label=&quot;load launchd permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Load launchd&lt;/h2&gt;&lt;p&gt;You need to &lt;em&gt;load&lt;/em&gt; the plist file after it&amp;#x27;s created.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;launchctl load com.launchd.example.plist&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To verify that it&amp;#x27;s loaded&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash{outputLines:&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash{outputLines:&quot;&gt;BASH{OUTPUTLINES:&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash{outputLines:&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;launchctl list | grep com.launchd.example&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;-  0  com.lanchd.example&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Receiving output, i.e. &lt;code&gt;- 0 com.launchd.example&lt;/code&gt; means that the job is currently loaded&lt;/p&gt;&lt;p&gt;&lt;code&gt;-&lt;/code&gt;: means that it is loaded but is not running&lt;/p&gt;&lt;p&gt;&lt;code&gt;0&lt;/code&gt; means job finished successfully. Any positive number means that there was an error, and negative number denotes a termination&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;To unload the job&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;launchctl unload com.launchd.example.plist&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;be-aware&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#be-aware&quot; aria-label=&quot;be aware permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Be Aware..&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Loaded launchd will still work with Terminal.app closed, but it won&amp;#x27;t work while your computer is asleep or shutdown.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;If it wakes up &lt;strong&gt;before&lt;/strong&gt; the job was executed, or there is more job to be executed, it will continue to work without having to &amp;quot;re-loading&amp;quot; the job&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;If it wakes up &lt;strong&gt;after&lt;/strong&gt; invocation time period time, and there is no more job to run, it won&amp;#x27;t re-execute&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;One workaround can be waking up the mac a few minutes before execution time by going to &lt;code&gt;Preference&lt;/code&gt; &amp;gt;&amp;gt; &lt;code&gt;Energy Saver&lt;/code&gt; &amp;gt;&amp;gt; &lt;code&gt;Schedule&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h1 id=&quot;more-about-launchd&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-about-launchd&quot; aria-label=&quot;more about launchd permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More about launchd&lt;/h1&gt;&lt;h2 id=&quot;directory&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#directory&quot; aria-label=&quot;directory permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Directory&lt;/h2&gt;&lt;p&gt;Below describes each directory where you can choose to place your plist scripts&lt;/p&gt;&lt;table&gt;&lt;colgroup&gt;&lt;col width=&quot;30%&quot;/&gt;&lt;col width=&quot;30%&quot;/&gt;&lt;col width=&quot;40%&quot;/&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr class=&quot;header&quot;&gt;&lt;th&gt;Type&lt;/th&gt;&lt;th&gt;Location&lt;/th&gt;&lt;th&gt;Who Runs&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td markdown=&quot;span&quot;&gt;User Agents*&lt;/td&gt;&lt;td markdown=&quot;span&quot;&gt;~/Library/LaunchAgents&lt;/td&gt;&lt;td markdown=&quot;span&quot;&gt;Currently signed in user&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td markdown=&quot;span&quot;&gt;Global Daemons&lt;/td&gt;&lt;td markdown=&quot;span&quot;&gt;/Library/LaunchDaemons (Use sudo to edit files)&lt;/td&gt;&lt;td markdown=&quot;span&quot;&gt;Currently signed in user&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td markdown=&quot;span&quot;&gt;Global Agents&lt;/td&gt;&lt;td markdown=&quot;span&quot;&gt;/Library/LaunchAgents (Use sudo to edit files)&lt;/td&gt;&lt;td markdown=&quot;span&quot;&gt;root or specified user with Username key&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;blockquote&gt;&lt;p&gt;In short, place the property list under &lt;code&gt;~/Library/LaunchAgents&lt;/code&gt; for user specific jobs, under &lt;code&gt;/Library/LaunchAgents&lt;/code&gt; for jobs needed for every user, and under&lt;code&gt;/Library/LaunchDaemons&lt;/code&gt; to run, for example, daily maintenance tasks.&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;plist-skeleton&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#plist-skeleton&quot; aria-label=&quot;plist skeleton permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;plist Skeleton&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token prolog&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype name&quot;&gt;plist&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype name&quot;&gt;PUBLIC&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype string&quot;&gt;&amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot;&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype string&quot;&gt;&amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&lt;/span&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;plist&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Label&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;com.launchd.example&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Program&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;/Users/Me/Desktop/push_release.sh&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;RunAtLoad&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;plist&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;label&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#label&quot; aria-label=&quot;label permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Label&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Label&lt;/code&gt; is required for every job and should be &lt;strong&gt;unique&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Label&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;com.launchd.example&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;what-to-start&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-to-start&quot; aria-label=&quot;what to start permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What to Start&lt;/h2&gt;&lt;p&gt;&lt;code&gt;ProgramArgument&lt;/code&gt; defines the path to the program&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ProgramArgument&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;/Users/Me/Desktop/push_release.sh&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;when-to-start&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#when-to-start&quot; aria-label=&quot;when to start permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;When to Start&lt;/h2&gt;&lt;p&gt;&lt;code&gt;RunAtLoad&lt;/code&gt; &amp;amp; &lt;code&gt;&amp;lt;true/&amp;gt;&lt;/code&gt; starts the job as soon as the script gets loaded&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;RunAtLoad&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;StartInterval&lt;/code&gt; is like a timer. This will run the job &lt;strong&gt;every&lt;/strong&gt; 3600 seconds, every hour, after the script is loaded. The timer stops when computer is asleep.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;StartInterval&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;3600&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;StartCalendarInterval&lt;/code&gt; lets you to specify time to run the program. The below example will run the program &lt;strong&gt;everyday&lt;/strong&gt; at &lt;code&gt;11:11PM&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;StartCalendarInterval&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Hour&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;23&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Minute&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Available Keys: &lt;code&gt;Month&lt;/code&gt; (1..12), &lt;code&gt;Day&lt;/code&gt; (1..31), &lt;code&gt;Weekday&lt;/code&gt; (0(Sunday)..7(Sunday)), &lt;code&gt;Hour&lt;/code&gt; (0..23), &lt;code&gt;Minute&lt;/code&gt; (0..59)&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Below example will run once an hour&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;StartCalendarInterval&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Hour&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can use &lt;code&gt;&amp;lt;array&amp;gt;&lt;/code&gt; to define multiple calendar intervals&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;xml&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-xml&quot;&gt;XML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-xml&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;StartCalendarInterval&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Hour&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;23&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Minute&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Minute&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Weekday&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Run at 11:11PM every day and every hour on Sundays&lt;/p&gt;&lt;/blockquote&gt;</content:encoded></item><item><title><![CDATA[[Git]: Authenticate GitHub Account with SSH Key (macOS, Linux)]]></title><description><![CDATA[Create new ssh key If you're in an environment that uses  sudo  for most commands, be sure to include  sudo Put email inside "". Press enter…]]></description><link>https://ellismin.com/2020/03/git-auth-ssh/</link><guid isPermaLink="false">https://ellismin.com/2020/03/git-auth-ssh/</guid><pubDate>Sat, 21 Mar 2020 00:00:02 GMT</pubDate><content:encoded>&lt;h2 id=&quot;create-new-ssh-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-new-ssh-key&quot; aria-label=&quot;create new ssh key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create new ssh key&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ssh-keygen -t rsa -b &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;4096&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -C &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;your_email@example.com&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;If you&amp;#x27;re in an environment that uses &lt;code&gt;sudo&lt;/code&gt; for most commands, be sure to include &lt;code&gt;sudo&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;Put email inside &amp;quot;&amp;quot;. Press enter for prompts&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;copy-ssh-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#copy-ssh-key&quot; aria-label=&quot;copy ssh key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Copy SSH key&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;pbcopy &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/.ssh/id_rsa.pub&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Copies generated ssh key to the clipboard&lt;/p&gt;&lt;p&gt;If &lt;code&gt;pbcopy&lt;/code&gt; is not applicable, run &lt;code&gt;cat ~/.ssh/id_rsa.pub&lt;/code&gt; and copy the text&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;save-copied-key-on-github&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#save-copied-key-on-github&quot; aria-label=&quot;save copied key on github permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Save copied key on GitHub&lt;/h2&gt;&lt;p&gt;Go to &lt;a href=&quot;https://github.com/settings/keys&quot;&gt;SSH and GPG keys&lt;/a&gt; on your profile —&amp;gt; &lt;code&gt;Settings&lt;/code&gt; —&amp;gt; &lt;code&gt;SSH and GPG keys&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:205px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:199.5121951219512%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFbklEQVRIx51WW2xUVRSdL7UIFYgolUeiH0aFmCiJ+mOi0RiiEhPjr38aebTAn/IaKJV22pm2M53p9DVtpXXezzt3HnQQkZbW6D+JfEHRGvkAUkpCQ6HLvfedM70znVbiJHvOvWefs85+rnMtz9VtxfMvbMPmLduXCc9v2f4ivv3uCHa99Y7Mvf/BR3j9jV2o2/oSdr39GnZ/+CZ2vLINL7+6E4xl4b9nNm7CmnXrSTYsk6drN+DJNbWoIT3LEzVrSdahZu16PLW2VvQbn90s+wVw46Y67P74UzQcPIS9+w5g3/567N1vjPto3GuS/fUNOFB/UMb6hoP46utv0NxiQ3e3F5/s+cwAbLG1IhQO4+LFn5HWdWSzWeRyORlZ8vk8xsbGcO7cOSSTSSRI9IyOeDwuetZduPATvSdga7PDousZpFIpJBIJnG76HseOn0ArKawnT8Hp6oLb44Hd4UB7RyeOn7BKPI8cPYaGQ4dxprlFgDOZjOzXtDQsbo8Xoz/6xap0Oo1oNAqdLDULz+tF63mzehYdr6E5Bg6HI7Acszbi7MioLOATMjSmUho0AtE0rUxkXlsuDMwuR8gYSygSRYxeGFAmIxGxVhYXLWOrzMIWp9N6UYw1iUTSAIwQIJvLIKFQCFarFX6/H2Gad3Z50Nfvw9DwD3DRc29fP/yBgKxV4MrtJcBoTCxTlgRow8DAgJzO2Y/F4ojGYnRYWGKk1hpWpqtYWARkMIkhjdlsTgDFAuWqKSFmMBaV5RJgjCxIFxcuBdt4XjZXASbvtDdGYSuzUJWEKupcscDZolxuybrKBBklpCyMGUkxilKDrbWNCrgDXm8PHO0d6OjsRGNTExVwc+nQyhoVQOUyYVk4w/ySKRYnZ5pLJxAIysgSDAbFPeWF2Vo1clvyfguD8YsxmUK+6LKRnGypRMyFbgY1AzJWCVC53Ga3w0Ps0el04lTjabTYbLARgTSebpIQcL/39w+U4ltmoQJkUfHhZyYL1de8sCRFElEerQjIL6wIUvxUmTAojxwXYaPiGjNBLIuhGZCB7I52oa4utwfMk212B05YTxrzFI5Ase3MYKu6zCRqXmyOU9pEFOZ6XNXCoeFh6V+OHbs/OjoqJZMi1801WFnYZYDc+AzKgK4utxR2X38/uqm4OeucWT5AAf6nhdwByuXzhYK4raRQGJM7Y6W2qw6YiJdc9nR3Y3BoCCMjI/ANDkoL+nw+ybI5CZVSBqgldaSSBo0PDPgEZJgIlQu7y+0W9811Ws1K1pUAhyO9CMeCpDDaLFdqvaXrdIkDi7Svm6REsAkD8LDvC/SFXMhnxkipLSPPEpAJoFLKAAtaAXqKF6eFxlmpbjJzVs3svKrLe9xfwhX0IpPKoKW1FXbqDu4WB3WH0+VCO/Eid4qjvR0t9NnBPFmZpLKkvNfxOVwBL87nC0RRmhAp929UmNy4vMUdelZS3cKUAbjz6LtoHrIjr+fkiuQO4buh7N7QymPLFppFkYjwYdugC4FYCOOXxuXe7XS6qAaHMDk5ifHxcUxMTODy5csrCuunpqaoCQoGY8fiVCr5Mfzf3+LioozXr1+X68Li7PEhTv4/ePAAN278SYpp/DUzg5mZv/HPzZtYWFiQTY8ePZKxUh4+fCiA165dMwAdrh66U5My+etvv+OXSxP44+pVXBonVyenBPBxftPTNwxAf4ToXs/izp07mJ+fF0vn79/HvXtzmJubw+zsLG7duoXbt29XFdbdvXsXV65cEVay8JeXuqS6vV54e3qEHM6SDBM/qi/VagVdtbC76IOTS4UVzDZnzjQLUE9vrxygvsweG9BPF3qYfFftZtRdutQF6oJKriopOZif/wXYGk0hXd1pQwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/9854e1fc9c0a611dc4ce0088903d49f5/85860/1.png&quot; srcSet=&quot;/static/9854e1fc9c0a611dc4ce0088903d49f5/85860/1.png 205w&quot; sizes=&quot;(max-width: 205px) 100vw, 205px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:363px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:94.88372093023256%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAATCAYAAACQjC21AAAACXBIWXMAAAsTAAALEwEAmpwYAAAB9ElEQVQ4y6WT2Y/TMBCH+/fDExJ7sJs2x6bXJrEdpyl96wO0qTikCnEKEEUl7T6wK8Q7/TGO05ClabOISJ8mhz3+PBM3BoMBykRRlEUhQli2i5Z1AZOi7XTQNJ2Mbs+D53NceiyP+l7NbRxK6Fx0YFquTtRycN60cPLIgNvuFQn/EBxIGA8hemTSdimpi37/EnEc5wyzcZLGRSXCUNYk7NpwrRbODQOObRffqsgWkPLwlmUowEQEFsYUB+C5gZRRZlcgt4bh4YQq2l2BY4vh1GbwmUS8x/JuhjSACwkRanbM/t1QwnA5jsjwhAw9ZRj/p6EyCymqDvLctKhjiVrDKDdstrXhGZkek6XRFng8VN9uz7mToVrRDzg1g7rNCabhvBrGeP1JObM93D/tZ5EzhiDYj+8H9YZq5a2heg7p3xSiGsZ5fZdVDR+0WFbHhyajZ1FZv50abpNsUWdWvRMhdU/qGHD1X0Z7jp9OqOY2yiejvAVOWzgyPdyjGtodqo+83YSdLVONVVkKw9FohNlsVjCdTokETyYJnhIvn8/w4lkO3SdJssN4PNYJ1QqTyQR/X1c/N/h6s0H6Y4Mv339hca1R91XXYrHQCZWqyr5erwtWqxTvPi3xllDx9ccl3n/+hjcUX31YIl2taIwmTVOac4X5fI7ffvWnagLwcWgAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/b202eab28b23734d1425dd5f92b65b41/4e786/2.png&quot; srcSet=&quot;/static/b202eab28b23734d1425dd5f92b65b41/2eb24/2.png 215w,/static/b202eab28b23734d1425dd5f92b65b41/4e786/2.png 363w&quot; sizes=&quot;(max-width: 363px) 100vw, 363px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Click &lt;code&gt;New SSH Key&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:796px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:18.13953488372093%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAECAYAAACOXx+WAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAyUlEQVQY02WOu07EMBBF89+09HR0jpTdPCBrx4+xt6ZCEFFR7EKB9gv4hoPtgASiOBrPjHXmNkopVNsyTXeklIgx/kOkIH8of7XRXN4+ePhcuXq94fp0S6O1Zp5ntDZ47/HObXhXe5cRCaQoWS61FmE5ZK1lfV45X955PK08nV9o+n5gGEf2fU+3H2i7EdUN+T1ts92O+4PhsAizCZXwLSyEEBAvHCVxDImmpsiJCjYvjIssGetjTVfmiwtoGzB2qz9C+SWWkjzzBZlf9fQeedGDAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/791b039ade8f82ec962b187d61504b2b/d48f1/3.png&quot; srcSet=&quot;/static/791b039ade8f82ec962b187d61504b2b/2eb24/3.png 215w,/static/791b039ade8f82ec962b187d61504b2b/05ed2/3.png 430w,/static/791b039ade8f82ec962b187d61504b2b/d48f1/3.png 796w&quot; sizes=&quot;(max-width: 796px) 100vw, 796px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Type in any title for your SSH key and paste copied ssh key in then &lt;code&gt;Add SSH key&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:815px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:46.04651162790698%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABJElEQVQoz52SX0/CMBTF99199tFXv4dvJhqBwWJghIgwxkycCWSs+wOLa7vjvV2HPMxEbfLLbU9vT9vbOnleIDmkqKWEVApS9mB13TTg1lDsg5tTFCUOaYrPurYGsteUN9Ras92PZhwcPuGxqsASn0BTR5t+HzSvLV1uh9mMDAVdd+49Y7t8RbRaY/OyRNhBGkee29Lc2yZEuA4MPGa9y69OVWuY7PaYDYbwhyMTp08DTC/Gl/juGDNmPMGcMLkjF4uJ920oRIYwDBEEtDOd4OM9RkFlyEk3ZLkho35mNIE8Fa1uc8rjiR7OXhltPc9FlVQQqZo2/pLaPpwxXOUR7ncuHvcekkqgUU37haT6E0pZw7v4AVf+Da4Xt4jK+PzP/tN43RdSGbAErvX3UwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/5b400d8c0183d4f2b08084b6bb7733ee/ef916/4.png&quot; srcSet=&quot;/static/5b400d8c0183d4f2b08084b6bb7733ee/2eb24/4.png 215w,/static/5b400d8c0183d4f2b08084b6bb7733ee/05ed2/4.png 430w,/static/5b400d8c0183d4f2b08084b6bb7733ee/ef916/4.png 815w&quot; sizes=&quot;(max-width: 815px) 100vw, 815px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Created SSH key looks like this
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:788px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:34.418604651162795%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAAA+ElEQVQoz5VRSU4DMRCc//+AAw+IxEcQJxAnDiARTSRPxtu0PYuXqbidDBApQlBWeWm1q9vlRimNz/0eQnTIOeOvWMtgtJPA/ccD7t53eDVvaLz3kEpBG4MlBMQYEcp6ZvzB8M1LTooJ0ms8dS947J4hxh7NNE0YC4kIx2NfxaVUUFrXIhv5JVqbGjccK3vOtWa46rzhSUp5uaRqh/9FWBbM44hULKuCbXuoXXFF7kQWDgOdvVrXX8mYycFLjVzOzfYR7J+xFs45WDtgILr6AnwJ3BZl5Lyyh3MVoFKF3IiOMqTLUD4VUVf8slC0oKcEYSO0SzdFN54A5+4gPirrW44AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/d9fff91786e445dafbc148f8627d4c66/ea7fb/5.png&quot; srcSet=&quot;/static/d9fff91786e445dafbc148f8627d4c66/2eb24/5.png 215w,/static/d9fff91786e445dafbc148f8627d4c66/05ed2/5.png 430w,/static/d9fff91786e445dafbc148f8627d4c66/ea7fb/5.png 788w&quot; sizes=&quot;(max-width: 788px) 100vw, 788px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;add-key-to-ssh-agent&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-key-to-ssh-agent&quot; aria-label=&quot;add key to ssh agent permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add key to ssh-agent&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Run ssh-agent&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash{outputLines:&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash{outputLines:&quot;&gt;BASH{OUTPUTLINES:&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash{outputLines:&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;eval &amp;quot;$(ssh-agent -s)&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Agent pid 5190&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;(macOS only): modify &lt;code&gt;~/.ssh/config&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Host *&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  AddKeysToAgent yes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  UseKeychain yes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  IdentityFile ~/.ssh/id_rsa&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Add SSH private key to ssh-agent&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ssh-add ~/.ssh/id_rsa &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Add -K option for macOS users&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;test-ssh-connection&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#test-ssh-connection&quot; aria-label=&quot;test ssh connection permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test SSH Connection&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash{outputLines:&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash{outputLines:&quot;&gt;BASH{OUTPUTLINES:&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash{outputLines:&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ssh -T git@github.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Hi EllisMin! You&amp;#x27;ve successfully authenticated, but GitHub does not&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;provide shell access.&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Type yes to the prompt&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Make sure to use &lt;code&gt;SSH URL&lt;/code&gt; when you&amp;#x27;re authenticated via SSH key. This applies to commands such as &lt;code&gt;git clone&lt;/code&gt;, &lt;code&gt;git fetch&lt;/code&gt;, &lt;code&gt;git pull&lt;/code&gt;, or &lt;code&gt;git push&lt;/code&gt; to a repository&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:340px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:44.18604651162791%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABoklEQVQoz01STWvbQBDV/z+1wbGsz9WXLWNLq2/ZITcT30qpCyWQW0sopZSQggPBl9eZ2Trx4Wl35s2+eTtay/N9+EGARZ5DqQie58s6tW3Y9gxxnEDrCn3fo+s6WeumwW63w/F4xMPjM+6/P+Hbj7/49PkLrFApfPh4RUKeCDA4F8WxNApDhdV6jWEYRGwcR7Rti/3+DqfTCb+eXvDzzxG/n19xOHyFlaYZkjRFkqTI86U4CkgoimLJs3AQhuCbKGrkUmNuFAQml8QR5lmK25stNe1haa1RFCWqqkJZlgKOy1K/5YqikJghnDYcn+VxrNcFCuJ4JBYHPDd2kWWZXJHBLlQUwXFdys9lDI7jSh3zfBOO+fzVZIpr20FPY7F4Hk3zjrpu0FzkmOfOvLZt9153PkP5FYmya3HIn+3YC8ahw+b//hyziIhR3WUtYyOg3GYgzrwCiw/MEi1QixpeVsl+ojTivKY/24kLcdmZWjs28KnWTSv48wpDb3iLn8KUSIeIZNkQWUvRJNIIqQH/OXZo3mEvdYxZYsTYQLZq6DaG/wf/GCBQD9DRjQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/7de2ec4bac68eac53848a1d23cf19706/9f933/6.png&quot; srcSet=&quot;/static/7de2ec4bac68eac53848a1d23cf19706/2eb24/6.png 215w,/static/7de2ec4bac68eac53848a1d23cf19706/9f933/6.png 340w&quot; sizes=&quot;(max-width: 340px) 100vw, 340px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:334px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:43.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB7UlEQVQozzVS227aUBD0z7dJW9KERiVqEsBgt8jI2MdXoM1DI8SlUtQbby0JTbglNVIMGGzyMt1zTB9GO7szK+/xrvTi5StkMgfI5U6QOXiNw6Ms9vb38ez5HgpFGYZhol6vE3z4fgrXdeF7LrSajeOigcIHhreyifx7BklRVMhyCaVSirKigNfK5TJKhEqlAk3ToKiq4NVqFaZpwrIsMMYEbOK2xeA4NiTGLHieBx5NEg1utm0R+XQ1wxC5rteEh+efLy/R7XbR6XTQbrfRarXQ633BxcUFpCRJEIYhlssloijCirDebLBaRVgsqLZe4/ExFDGKUqx3tTBcYLlakbbBQzDHj599SH+DAIPBNX79HmA6m+HuboTpdIab4RABmYL5XPDxZILRaIzxeIL7+wdc3wzx5/aWPAEW9PHe1Xdcff0GiU8Txwk2BB7jJOVJsqUYUy3GdrsFfwmH8G5iocc7T0gv2T49od+nCX3fw8eGL9Coe2jW/+ec++L/8q26rid4Y6c3G57wcP6pSVew276k6RaOznW8KdRwphjIyTUcUp7Np7njOGKjNi2G40w1hHZM/mxep3NJ/bphwSWvZDAHJ+X0htSqBbnCqInhVDFRpPvy6N5sMjqOKyZQNAunKmnke0eec+rjPfZO/wfIvExruda+qAAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;7&quot; title=&quot;7&quot; src=&quot;/static/390e39f6121302ca92d699cd41909c4e/86d36/7.png&quot; srcSet=&quot;/static/390e39f6121302ca92d699cd41909c4e/2eb24/7.png 215w,/static/390e39f6121302ca92d699cd41909c4e/86d36/7.png 334w&quot; sizes=&quot;(max-width: 334px) 100vw, 334px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Git]: Remove All Commit History]]></title><link>https://ellismin.com/2020/03/git-history-1/</link><guid isPermaLink="false">https://ellismin.com/2020/03/git-history-1/</guid><pubDate>Sat, 21 Mar 2020 00:00:01 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; checkout --orphan temp_branch&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[REVERT]: reverted commit history&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; branch -d master &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Delete master branch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; branch -m master &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Rename temp_branch to master&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push -f origin master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Git]: Branch & Merge]]></title><description><![CDATA[Create branch Switch to branch Create & Switch to branch Check branches Some Scenario You're currently on a master branch You've decided to…]]></description><link>https://ellismin.com/2020/03/git-branch/</link><guid isPermaLink="false">https://ellismin.com/2020/03/git-branch/</guid><pubDate>Sat, 21 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;create-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-branch&quot; aria-label=&quot;create branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; branch &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;branch_name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;switch-to-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#switch-to-branch&quot; aria-label=&quot;switch to branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Switch to branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; checkout &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;branch_name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create--switch-to-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create--switch-to-branch&quot; aria-label=&quot;create  switch to branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create &amp;amp; Switch to branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; checkout -b &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;branch_name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;check-branches&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#check-branches&quot; aria-label=&quot;check branches permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Check branches&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; branch&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;some-scenario&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#some-scenario&quot; aria-label=&quot;some scenario permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Some Scenario&lt;/h2&gt;&lt;p&gt;You&amp;#x27;re currently on a master branch&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;[Commit1]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    └─ master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You&amp;#x27;ve decided to implement a new header, so you create a branch named &lt;code&gt;newHeader&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; checkout -b newHeader&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;┌─ newHeader&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;[Commit1]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    └─ master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;While you&amp;#x27;re working on making a new header, you decide to commit a change&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[WIP]: making a new header&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;[Commit1] &amp;lt;─── [Commit2]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    └─ master      └─ newHeader&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;newHeader&lt;/code&gt; branch is ahead of master&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;All of a sudden you have to fix a serious bug that doesn&amp;#x27;t depend on a new header that you&amp;#x27;ve been implementing. Then you&amp;#x27;d want to create a new branch from master&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; checkout master&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; checkout -b bug32&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You&amp;#x27;ve worked to fix the important bug and commit a change&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[FIX]: bug32&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;┌─ bug32&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;       ┌────── [Commit3]    &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;[Commit1] &amp;lt;─── [Commit2]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    └─ master      └─ newHeader&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;newHeader&lt;/code&gt; and &lt;code&gt;bug32&lt;/code&gt; has complete different changes&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;You&amp;#x27;ve finished fixing the bug so you&amp;#x27;d want to deploy it&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; checkout master&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; merge bug32&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Git]: Pulling Commit from Other Repository]]></title><description><![CDATA[Copy commits from other repository with cherry-pick]]></description><link>https://ellismin.com/2020/03/git-cherry-pick-1/</link><guid isPermaLink="false">https://ellismin.com/2020/03/git-cherry-pick-1/</guid><pubDate>Sat, 21 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Adding other repository as a remote&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; remote &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; other &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;GitHub_Path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Retrieve commits from other repo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; remote update&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Check commits of other repo &amp;amp; current repo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log --all --oneline --10 &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# i.e. shoing 10 logs&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Cherry pick commits&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; cherry-pick 1a2b3cd &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Put more commit SHA if needed&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Confirm local repository&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Push&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push origin master&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Delete other repo form remote&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; remote remove other&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# View remote repositories&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; remote&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Git]: Categorize your GitHub Commit Messages]]></title><description><![CDATA[Uncategorized commit messages Categorized commit messages Categorizing Commit Messages It is completely optional and can be a bit of extra…]]></description><link>https://ellismin.com/2020/03/git-commit-tags/</link><guid isPermaLink="false">https://ellismin.com/2020/03/git-commit-tags/</guid><pubDate>Fri, 20 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;uncategorized-commit-messages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#uncategorized-commit-messages&quot; aria-label=&quot;uncategorized commit messages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Uncategorized commit messages&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:578px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:52.093023255813954%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAABQElEQVQoz42S/06DMBSFff9X8g9/ROOcD2DiNthK1wKlwIABc8Dx9upYTNywyUkJhJOv3+3NMAz4PHYoq5pSoShKlGWFruvglvvu0vcu/WRu3E9CvOPp+RaLpY/1RsCn7IoCTdOgrimHBlSL/ywutNbA8z2kWY483yHfFTCJRWJTxCaBzTIm/qakDJfDhUotMXu9h7cOsFWaIylhFCOQCqExI8FJwaVwoUkirFZLRHHCZCc6lzTNYFLa8xxVtT/7vEYo5QLzt0eIQEGHEZQOeWfSrYLUmgv3+3qScnTok0MdxnzMKDZMdyRvzl3Xd+OR3SSHYZLwA/P5A01YUmlIVJoJ27blKTeH9tckJwnTzMJfe0zl/GU06dOzm3Ly49C9d8TXPI6EL7M7ujoCGxEwoZDbs8NQw1hLakjD8Xzh/1pfe9IDhAMQzQ0AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;uncategorized&quot; title=&quot;uncategorized&quot; src=&quot;/static/d3758a5b978734ff2c23562f4f8e3609/508ef/uncategorized.png&quot; srcSet=&quot;/static/d3758a5b978734ff2c23562f4f8e3609/2eb24/uncategorized.png 215w,/static/d3758a5b978734ff2c23562f4f8e3609/05ed2/uncategorized.png 430w,/static/d3758a5b978734ff2c23562f4f8e3609/508ef/uncategorized.png 578w&quot; sizes=&quot;(max-width: 578px) 100vw, 578px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;categorized-commit-messages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#categorized-commit-messages&quot; aria-label=&quot;categorized commit messages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Categorized commit messages&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:666px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:45.11627906976744%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABUElEQVQoz52S2W6DMBBF+f9Pa6WkaaU2ISsBvLAlYAwJkNzOuEUKUtuHIh2NbeBwx8ZTicBsMcd6d8RmH1AN4G8D7III20OIY6zc+BAKlMaiuXSw7fVXPCEDvLzOEMYaoVCIiGMsXa1IYJsLjG1RE83livbaoSWpqz/gaR1iuXxDkuZEijTLoZPU8Z/Ly3MN319BSA2pEoeQiuQZyrLC6VziXDKVm5eVcWu1tej7Aff7fYKnNLW8eEYYScTiizAWLmFljJNUJBkxde3kTdNiGEhIqSZCTYey3vjUaoHidEKWF8iLAlInND87Ka9zyjExp2S6rkdPUjxIPSH2mM+fENFBSKURU7vcMifll+rakrSGIXjMCUe6vsdwu00TZpnCcvXu9pAlipJxu1w5LR/SWMcx3+OPW9u4lJOEiab/b/Ph9oVTuL36TsQP/HWNktsDn5uYr7d81oL2AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;categorized&quot; title=&quot;categorized&quot; src=&quot;/static/4fe622b5368db1aca7e5ebbf0d8e67be/ace37/categorized.png&quot; srcSet=&quot;/static/4fe622b5368db1aca7e5ebbf0d8e67be/2eb24/categorized.png 215w,/static/4fe622b5368db1aca7e5ebbf0d8e67be/05ed2/categorized.png 430w,/static/4fe622b5368db1aca7e5ebbf0d8e67be/ace37/categorized.png 666w&quot; sizes=&quot;(max-width: 666px) 100vw, 666px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;categorizing-commit-messages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#categorizing-commit-messages&quot; aria-label=&quot;categorizing commit messages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Categorizing Commit Messages&lt;/h2&gt;&lt;p&gt;It is completely optional and can be a bit of extra work to categorize your github commit messages, but it clearly improves a readability. Below is the list of &amp;quot;tags&amp;quot; that I use when I write commit messages—most are self-explanatory.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;INITIAL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Used for initial commits&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ADD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Newly added features / components&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Used for updated existing features&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;STYLES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Commits regarding styles&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;REFACTOR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Used when restructured existing codes, usually for better performance&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;FIX&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Used to denote fixes&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;DOCS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Documents related i.e. README&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;REVERT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# When commit was reverted back to previous code&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;PRODUCTION&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Production related commits&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;WIP&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Used to denote Work In Progress for commits that are not final&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Sometimes a commit message seems to fall into more than one category. I simply use multiple tags such as &lt;code&gt;[REFACTOR &amp;amp; ADD]&lt;/code&gt;, &lt;code&gt;[ADD &amp;amp; WIP]&lt;/code&gt;, ...&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;setting-alias&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#setting-alias&quot; aria-label=&quot;setting alias permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Setting Alias&lt;/h2&gt;&lt;p&gt;You can set alias to use categorized commit messages. Refer to &lt;a href=&quot;/2019/04/alias/#alias-to-shorten-categorized-commit-messages&quot;&gt;Setting Alias on Terminal&lt;/a&gt; post.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[React + Node.js]: Implement Web Socket with Socket.io]]></title><description><![CDATA[Websocket Typical approach of Node.js application requires client to  request data , and the server  sends the response  back--this is HTTP…]]></description><link>https://ellismin.com/2020/03/mern-socketio/</link><guid isPermaLink="false">https://ellismin.com/2020/03/mern-socketio/</guid><pubDate>Fri, 20 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;websocket&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#websocket&quot; aria-label=&quot;websocket permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Websocket&lt;/h2&gt;&lt;p&gt;Typical approach of Node.js application requires client to &lt;strong&gt;request data&lt;/strong&gt;, and the server &lt;strong&gt;sends the response&lt;/strong&gt; back--this is HTTP protocol, but what if you want to notify a client when there&amp;#x27;s a change on the server? Imagine a messenger application. Your friend needs to be able to receive your message in real-time without having to request something to the server. This is where &lt;strong&gt;websocket&lt;/strong&gt; comes into play. Built over HTTP, websockets enable two-way communication where the server can push data to the client without receiving request. &lt;a href=&quot;(https://socket.io/docs/)&quot;&gt;&lt;strong&gt;Socket.io&lt;/strong&gt;&lt;/a&gt; is a popular library that you can use to establish websocket.&lt;/p&gt;&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;&lt;a href=&quot;https://mern-demo-prod.herokuapp.com/&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;&lt;p&gt;As an example, I&amp;#x27;ll be using this &lt;a href=&quot;https://github.com/EllisMin/MERN-demo&quot;&gt;MERN stack app&lt;/a&gt; to implement websocket. As user adds/deletes an entry, the updated data will be updated in real-time on other browsers as well. The complete project is available &lt;a href=&quot;https://github.com/EllisMin/mern-demo-production&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;h2 id=&quot;socketio-on-the-server&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#socketio-on-the-server&quot; aria-label=&quot;socketio on the server permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Socket.io on the server&lt;/h2&gt;&lt;p&gt;Install &lt;code&gt;socket.io&lt;/code&gt; on the server side&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i socket.io&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create a utility to initialize &amp;amp; get io&lt;/p&gt;&lt;p&gt;&lt;strong&gt;socket.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;httpServer&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;socket.io&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;httpServer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;getIO&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Socket.io is not initialized&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;creating-socket-io-connection&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#creating-socket-io-connection&quot; aria-label=&quot;creating socket io connection permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating socket io connection&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;app.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// DB connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mongoose&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; server &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Listening on port &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Create socket io connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./util/socket&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;server&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;connection&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Client connected&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Check the import directory of socket util&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;sending-message-to-client-on-adding-user&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#sending-message-to-client-on-adding-user&quot; aria-label=&quot;sending message to client on adding user permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Sending message to client on adding user&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;controllers/user.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../models/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; io &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../socket&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;postUser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; occupation &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; occupation &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;unemployed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; occupation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sends message to all connected users&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getIO&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;user event&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;add&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;_doc&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;201&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;User created&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;sending-message-to-client-on-deleting-user&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#sending-message-to-client-on-deleting-user&quot; aria-label=&quot;sending message to client on deleting user permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Sending message to client on deleting user&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;controllers/user.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;deleteUser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userId &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;findById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Couldn&amp;#x27;t find the user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;findByIdAndRemove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Sends message to all connected users&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    io&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getIO&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;emit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;user event&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;delete&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;User removed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;client-side&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#client-side&quot; aria-label=&quot;client side permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Client side&lt;/h2&gt;&lt;p&gt;Install &lt;code&gt;socket.io-client&lt;/code&gt; on the client side&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i socket.io-client&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-socket-connection--update-state-with-received-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-socket-connection--update-state-with-received-data&quot; aria-label=&quot;create socket connection  update state with received data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create socket connection &amp;amp; Update state with received data&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;front-end/App.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;openSocket&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;socket.io-client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;UserAddForm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./user-add-form&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./App.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;addLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setAddLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;deleteLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setDeleteLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetchUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createSocketConnection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;createSocketConnection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; socket &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;openSocket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    socket&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;user event&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;add&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;prevUsers&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;prevUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;delete&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;prevUsers&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          prevUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;_id&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;fetchUsers&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleAdd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;formData&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleDelete&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;user event&lt;/code&gt; listens to the event that was sent from the server&lt;/p&gt;&lt;/blockquote&gt;</content:encoded></item><item><title><![CDATA[[Mac]: Set up]]></title><description><![CDATA[List of things to set up on Mac Development Homebrew zsh: Unix shell built on top of bash & My My Zsh & Terminal theme (Dracula) Node.js…]]></description><link>https://ellismin.com/personal/mac-setup/</link><guid isPermaLink="false">https://ellismin.com/personal/mac-setup/</guid><pubDate>Thu, 19 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;List of things to set up on Mac&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Development&lt;ul&gt;&lt;li&gt;Homebrew&lt;/li&gt;&lt;li&gt;zsh: Unix shell built on top of bash&lt;ul&gt;&lt;li&gt;&amp;amp; My My Zsh&lt;/li&gt;&lt;li&gt;&amp;amp; Terminal theme (Dracula)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Node.js&lt;/li&gt;&lt;li&gt;Google chrome&lt;/li&gt;&lt;li&gt;Firefox&lt;/li&gt;&lt;li&gt;VS Code&lt;/li&gt;&lt;li&gt;Eclipse&lt;/li&gt;&lt;li&gt;MongoDB Compass&lt;/li&gt;&lt;li&gt;Virtual box&lt;ul&gt;&lt;li&gt;Kali-linux&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;MySql&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Productivity&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Dropbox&lt;/li&gt;&lt;li&gt;BetterTouchtool&lt;/li&gt;&lt;li&gt;Keyboard Maestro&lt;/li&gt;&lt;li&gt;ScrollReverser&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Optimization&lt;/p&gt;&lt;ul&gt;&lt;li&gt;CleanMyMac&lt;/li&gt;&lt;li&gt;iStat&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Security&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Prey&lt;/li&gt;&lt;li&gt;iAlert&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Personal&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Kakaotalk&lt;/li&gt;&lt;li&gt;Photoshop&lt;/li&gt;&lt;li&gt;Lightroom&lt;/li&gt;&lt;li&gt;Parallels&lt;/li&gt;&lt;li&gt;Skype&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[Mac]: Customize your Terminal.app]]></title><description><![CDATA[Z shell Z shell  is a Unix shell that's built on top of  bash , default shell for macOS, has more additional features and plugins. install…]]></description><link>https://ellismin.com/2020/03/customize-terminal/</link><guid isPermaLink="false">https://ellismin.com/2020/03/customize-terminal/</guid><pubDate>Thu, 19 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;z-shell&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#z-shell&quot; aria-label=&quot;z shell permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Z shell&lt;/h2&gt;&lt;p&gt;&lt;code&gt;Z shell&lt;/code&gt; is a Unix shell that&amp;#x27;s built on top of &lt;code&gt;bash&lt;/code&gt;, default shell for macOS, has more additional features and plugins.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;install zsh&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;brew &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;zsh&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Doesn&amp;#x27;t have Homebrew? Install with &lt;code&gt;/bin/bash -c &amp;quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&amp;quot;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://brew.sh/&quot;&gt;Homebrew site&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;oh-my-zsh&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#oh-my-zsh&quot; aria-label=&quot;oh my zsh permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Oh My Zsh&lt;/h2&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/ohmyzsh/ohmyzsh&quot;&gt;Oh My Zsh&lt;/a&gt; is a open source framework for managing your zsh configuration.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;install Oh My Zsh&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sh&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -c &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token string variable&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;token string variable function&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;token string variable&quot;&gt; -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh&lt;/span&gt;&lt;span class=&quot;token string variable&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;config&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#config&quot; aria-label=&quot;config permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Config&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/.zshrc&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Refer to &lt;a href=&quot;https://github.com/ohmyzsh/ohmyzsh/wiki&quot;&gt;Docs&lt;/a&gt; for configuration.&lt;/p&gt;&lt;p&gt;If you have &lt;code&gt;.bash_profile&lt;/code&gt;, you can put contents here&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;themes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#themes&quot; aria-label=&quot;themes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Themes&lt;/h2&gt;&lt;p&gt;Install your favorite theme &lt;a href=&quot;https://github.com/ohmyzsh/ohmyzsh/wiki/Themes&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://draculatheme.com/&quot;&gt;Dracula theme&lt;/a&gt; is one of my favorites.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[React + Node.js]: Deploy Your MERN Stack App to Amazon EC2 with SSL Encryption]]></title><description><![CDATA[This post is stale Stale because using Route 53 & Elastic Load Balancer & Amazon Certificate Manager are not necessary. i.e. this post tells…]]></description><link>https://ellismin.com/2020/03/deploy-mern-2-stale/</link><guid isPermaLink="false">https://ellismin.com/2020/03/deploy-mern-2-stale/</guid><pubDate>Wed, 18 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h1 id=&quot;this-post-is-stale&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#this-post-is-stale&quot; aria-label=&quot;this post is stale permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;This post is stale&lt;/h1&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;Stale because using Route 53 &amp;amp; Elastic Load Balancer &amp;amp; Amazon Certificate Manager are not necessary. i.e. this post tells to use both Certificate Manager and letsencrypt that are duplicate processes. New post is available &lt;a href=&quot;/2020/03/deploy-mern-2&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;heroku-vs-amazon-web-services-aws&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#heroku-vs-amazon-web-services-aws&quot; aria-label=&quot;heroku vs amazon web services aws permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Heroku vs Amazon Web Services (AWS)&lt;/h2&gt;&lt;p&gt;Both are popular choices for cloud services where you can deploy your web applications and are great for hosting them. Heroku, in my opinion, is a lot simpler when it comes to deploy MERN stack application, but I still wanted to cover them both.&lt;/p&gt;&lt;h2 id=&quot;prerequisites&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#prerequisites&quot; aria-label=&quot;prerequisites permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Prerequisites&lt;/h2&gt;&lt;p&gt;If you don&amp;#x27;t have MERN Stack project available, here is how you can set up a basic MERN stack application with REST API.&lt;/p&gt;&lt;h3 id=&quot;--react--nodejs-create-your-mern-stack-application---part-1-backend&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#--react--nodejs-create-your-mern-stack-application---part-1-backend&quot; aria-label=&quot;  react  nodejs create your mern stack application   part 1 backend permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;- &lt;a href=&quot;/2020/03/mern-1&quot;&gt;[React + Node.js]: Create your MERN Stack Application - Part 1: Backend&lt;/a&gt;&lt;/h3&gt;&lt;h3 id=&quot;--react--nodejs-create-your-mern-stack-application---part-2-frontend&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#--react--nodejs-create-your-mern-stack-application---part-2-frontend&quot; aria-label=&quot;  react  nodejs create your mern stack application   part 2 frontend permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;- &lt;a href=&quot;/2020/03/mern-2&quot;&gt;[React + Node.js]: Create your MERN Stack Application - Part 2: Frontend&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;In addition, be sure to go through some steps from the &lt;a href=&quot;/2020/03/deploy-mern-1&quot;&gt;last post&lt;/a&gt; on how to..&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;/2020/03/deploy-mern-1/#serve-indexhtml&quot;&gt;Serve the static index.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;/2020/03/deploy-mern-1/#create-production-build&quot;&gt;Build your client&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;/2020/03/deploy-mern-1/#whitelist-ip-on-mongodb&quot;&gt;Add whitelist IP on MongoDB&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;You can choose skip above steps and &lt;a href=&quot;https://github.com/EllisMin/mern-demo-production&quot;&gt;download the project&lt;/a&gt;. I&amp;#x27;ll be using this project to deploy on AWS EC2.&lt;/p&gt;&lt;h2 id=&quot;1-create-ubuntu-aws-ec2-instance&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-create-ubuntu-aws-ec2-instance&quot; aria-label=&quot;1 create ubuntu aws ec2 instance permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Create Ubuntu AWS EC2 Instance&lt;/h2&gt;&lt;p&gt;Go to &lt;a href=&quot;https://aws.amazon.com/&quot;&gt;AWS console&lt;/a&gt; to sign up with your account if you haven&amp;#x27;t. Once singed in, &lt;code&gt;Launch a virtual machine&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:55.348837209302324%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB2UlEQVQoz3VS207bQBDN//8BJL6sb2t7ba+vwU8ECaSGz2jFLdBStU2lUCCHmY1t4KGWxnuZ2TPnzMxMxjGOjueYLxbGFpZFqwXLtuG4Lq2OueO4VCkkafpfY/9Mxglseih8H64QOJ4vYDsOhOeZM/v4HCeJecCmsmyyMcnom/FPSokgCFAUBeq6RlmVKMvPprVGlueIogie58OneJ9IKJWiIn9OPgaecRZ2sjy+ZFAGYOCP1jSNuXcFMWfWVBLLsuGFEXxJoFV1YMiAOYEYMGLBgFoTo4HZR1BmGcnYxGeDXJXlSLPD20myUhliquUBTE/SmVXNNuzZFxIjQbVlAlVdmTuti3fJnG11dobT1Qrn5xdYX17iy3pNwbUpOgeOxjUMwxCu45o6MviYnM0Adl2H25sbXF9d436zwW63w5/tFn3fQxf51JCRuUwURBQfRoU6z0mNgrYZAJdL3D3+xuPfJzxsn7Dd/cPL8zPKrocdUL2oni3JHZvC4+MHoZmMkRk3ZGrK8uQEm4fv+PHzF172wOuefvQ17RJBJGmEKrSUvW1bs2fJguRaXohAEkPTA/XeFJb29dsVbu82Bmg/ACapolES6CkhsxsBmSHPYkPnlsrVDcYxLPkNg8OmzluEUCIAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/12aa9c9462c3d68a03b5acdc11012dbb/914ae/1.png&quot; srcSet=&quot;/static/12aa9c9462c3d68a03b5acdc11012dbb/2eb24/1.png 215w,/static/12aa9c9462c3d68a03b5acdc11012dbb/05ed2/1.png 430w,/static/12aa9c9462c3d68a03b5acdc11012dbb/914ae/1.png 860w,/static/12aa9c9462c3d68a03b5acdc11012dbb/7bf07/1.png 1128w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Search for &lt;code&gt;ubuntu&lt;/code&gt; and select &lt;code&gt;Ubuntu Server 18.04 LTS (HVM), SSD Volume Type&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:36.74418604651163%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAABcElEQVQoz1WSy07CQBSG+8q+hS/gBgoUepsC7bSFLpAF6t6NNyQEKLQFaoGIURuIye/MQBAn+fLPycm5TP6RdE2FplahqipqtZpQRVH+qW3bgkajIdRxHIHrugyKpk2hEpZnKpmmCV3XBZqmwTCMQ8xUZTEhFigrdCgFPcIb0bOY52zncJcodcQlCAK0fF8Ue56Hdss/0fI9gee5x63+4M1810GnTeGxbaU6MVCtVlGvW+jd3GKznCOKYjwMQjwJJngeThkzhLMYSRyzfISYKWedveG+H4L0+nh8HUPiTywWiygUCrjudhEOBwjDKUZRitFsiWGYYJFtkW2/8fmVY7fbIc9zwX6/Bz/J+w/uXjKsP3JIhBCUy2XIsoxOp4M0XbLJEabhBHE0w2Q8wpzFnDRNka1WyLLsxGazwRvTZJGyugSSZVnCSb6pVW9Aq5RQUyooyiUxRC6VhNvcMF03cG6iaRIEbR9XShMXl+xHEAe/XwLDiUBPdj0AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/8b9d76a050ec4fc0b3966dba76e821e8/914ae/2.png&quot; srcSet=&quot;/static/8b9d76a050ec4fc0b3966dba76e821e8/2eb24/2.png 215w,/static/8b9d76a050ec4fc0b3966dba76e821e8/05ed2/2.png 430w,/static/8b9d76a050ec4fc0b3966dba76e821e8/914ae/2.png 860w,/static/8b9d76a050ec4fc0b3966dba76e821e8/91608/2.png 1251w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Make sure that &lt;code&gt;t2.micro&lt;/code&gt; (Free tier eligible) is checked and click &lt;code&gt;6. Configure Security Group&lt;/code&gt;.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:43.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB00lEQVQoz4VSy67TMBDNr/UL2FQCQSVaWqRcqZ9R9V/YsmaLEI/2LuCqIGiapGmapx3n5Tx7GBvdu2WkozkzssczZ2ykogRLQoS+C57GiHkBXkjUbQ9Rt6iaXqOUHVjZ6HzVdBjGEcput5vGoxmnkwXHtuA6J9inIxzHQRyFYGkCzhKkSYQkiZGmiieaJylHzDLiCeI41lC8bVsYQRji4vsoihJSNnQx1Sipu7RoqdsGwzBipI76fiD06CnWUJwwDMOTN1T1KIr0C1n271VVUOQFsqJCXtYoqwpN0+B/pkY3gusVPnWoCit/pdjzPMIZruuQDJb2lnWEbdsIggCHw4EkchCGgZbI9y84n9V5F0ZKWjjuGQnjELSgPK8gSXSFWrYoqMOm60k3hkzklG+1hpx4Jgq43gXe5QqeCX3GuDKJ306AWHTYWT/x7sN77B+O2P/4gx1B+XuKP379jk+7B/yyAxQdkEmAVSPcgMMNM/oBAyJBS5FSag3V/F++fcaLVy+xXK2wXC6xWCw05vM5VpSbTqfYbrdar67r9CKEEDRVrrnS2ajrWuum/tX9fo/Xz5/BfPsG5t0d1us1TNPUmM1mmEwm2Gw2uuDjVhlj4Jw/FfwLzqCNWdPCjk4AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/914ae/3.png&quot; srcSet=&quot;/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/2eb24/3.png 215w,/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/05ed2/3.png 430w,/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/914ae/3.png 860w,/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/b5dee/3.png 1237w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Add more types: &lt;code&gt;HTTP&lt;/code&gt; and &lt;code&gt;HTTPS&lt;/code&gt; by clicking &lt;code&gt;Add Rule&lt;/code&gt;. Once added, click &lt;code&gt;Review and Launch&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:38.604651162790695%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABIElEQVQoz32Q2ZKDIBBF+f9fnERTqaRcWBRZVNDcdDOjL5MZilNNN71wEdZHjC5AjR4uzNA2IC4Znogrs2FdItwo4a3CMkfMaQfwwqclrlWFy+WrUFVX1ITRGuMwwBgNpRS0VhQjqyShzviB1t9+CAFiigmSnK7r0PUSTU/NRm5mEOcZ27YhE8Xmw+aP8J3gZy7LUqY472GGEY/HozT05O/7Xni9Pkv8JXmaplJ4v99R1zUGavR8Psu5bdvy8tvtViQ553DkM1LKU+oRExwMdLDWYiJijOVioD/kRPabpimNOde5qTRm2G/bBn3fF0XsC0OFh2z+I15sU0qnDHl+vMa6piKf4YFcr7VBoMH8CGEHDeyZ9vonW15+7Ppv3p4T3tUUaGHhtG/rAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/b826d31930244cea9862c7ad11c36cdf/914ae/4.png&quot; srcSet=&quot;/static/b826d31930244cea9862c7ad11c36cdf/2eb24/4.png 215w,/static/b826d31930244cea9862c7ad11c36cdf/05ed2/4.png 430w,/static/b826d31930244cea9862c7ad11c36cdf/914ae/4.png 860w,/static/b826d31930244cea9862c7ad11c36cdf/5a791/4.png 1248w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Click &lt;code&gt;Launch&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:60.930232558139544%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAABs0lEQVQoz52S2ZLcIAxF+f8PSyqzJJXXVLrG3d4Ndhsv0MbLDZcZEiePcdWxJGQukrCoqxyyqTzlBxV038KaCfM0wMxjYJ60t4NfH4ONcP1hR+BYcewrxDG9YSi/o02/or29oPOWyOQpoK4vkB7m1fUZbfYNXfMj0NLKC8xUYF8qwEkIZzvMY4PHJGE9i2k9KvCYVYhpz8Q1fm/mO4zpfZU93GOAUFWFLHlDrwfc7z3atoXydN0dfa993EFKBWMt1nWDc2tgcQ77fiA+bt1hlx3iy+dPeH1+wjzP0Lr3Qi2maYL1AmfWdfU4bNvmhfYQH8cfwegJpRR+Xi6g7bruN1LKUC39uq7RNI2vuA+28l0xz46apkaaF7hcC6hOQ/CjPM998h4sRQg3UqwsS2RZFg7UWgch5hgPwxD2JEkS9rBLwRcTy7Lgf59lA7TdYJ2fIatI0zTMieJsj5WM4xhmGQ/jvDi7aP/l+MgJthpFCFvkjGJcFEWAoyG32y20TZ97OY44XxYRWmZ18SRWxRuMsTHmr0ooworpxxs/+4KqhAsUos8N77/Je+z8PxdjVn3On6HGLxqImI+jgowZAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/db07a606236a468a76f42def99bad920/914ae/5.png&quot; srcSet=&quot;/static/db07a606236a468a76f42def99bad920/2eb24/5.png 215w,/static/db07a606236a468a76f42def99bad920/05ed2/5.png 430w,/static/db07a606236a468a76f42def99bad920/914ae/5.png 860w,/static/db07a606236a468a76f42def99bad920/0f529/5.png 1259w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Create a new key pair. Name your key (filename), &lt;code&gt;Download Key Pair&lt;/code&gt; then click &lt;code&gt;Launch Instances&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:687px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:71.16279069767442%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAACQklEQVQ4y52T647aMBCF89StVKkP1Fb900do1WpLEQhY7pAsgc09ISTBSeyE0xkH2G37r5Y+zngGH49txVitVuj1ephOpxiPxzoeDoeYTCbo9/vg+mg0wmAwwHw213muM7ZtI01THI9H+L6Pw+EAI89zxHGMJEnuysUwDPX8lmM4xwRBoPNsxIZRFCHLMlRVBYMLi8UCpmlqNpsN5vM51uu1znOHy+VS12azme6QlXMM/4/nlmWhbVsY7Mytuq4Lx3F0dxyn6QlCCJzPZ/ApOC7LUs+Zoij+QUoJgwNuuTtehIT1eoSiyFFqI/GHyc2UuW1a1zV4GEkS4+D42Acn7LwjTCfR+kRqPYd4ckmdGOkp053yRqy3mDfgmLvXhvzjeR422y2spx3s/QFxckRVS7rkGqKsUJJyB3wkhmMlCSU7JYQ443K5dIa2vacLXukH4Z2UUvfFd5PX0GaFkMjFi4pKkRMZkinaRqJRFe0kdbIbN/17XMBrBlMb3x5G+PFriu+9CRZW+HLkXVxh7ZdIyxbRWSEsOoJcwsskXMKnmOe+RsH0C2zcE9bOCdP9EU7y6g6/LlN8GUaYk+lgf0Z/V2BI+tPK8WDmWh8dgUdXYEw6ehZYBBVmXoWJU2IR1ohEA27daNsL0rrFc6ZocUZm+R0zrmElHVzfnyShYKdS41KnHpFULYRqO0N+mbJWGtk0RHvVK6qjkg1q1isFPcLaF1gRC+p8Q9rwl4L/GFHeYBOUePNhi7cft3j3ycT7zxayUuE30dghcLl2tysAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/e45243618db0ce24e5e3ec5257f51122/aec65/6.png&quot; srcSet=&quot;/static/e45243618db0ce24e5e3ec5257f51122/2eb24/6.png 215w,/static/e45243618db0ce24e5e3ec5257f51122/05ed2/6.png 430w,/static/e45243618db0ce24e5e3ec5257f51122/aec65/6.png 687w&quot; sizes=&quot;(max-width: 687px) 100vw, 687px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Click &lt;code&gt;View Instances&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:52.093023255813954%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAABeUlEQVQoz42S627cIBCF/f4P19+V0nbjJLWNMQZzNwZOB9KtNmojFenTnLHRMLfBWAupJJx3qABKrZ1cC3LJnUK6PPifUzCItGN2C25qxKhecJMjXo836Kjhi4dJFiJoyGhgs/03V8NAEwN3ES/S4PuqcNsUfqwSz1yCGwdB/zYXMB8Oi/EQPnS/86CFj9jD2RlWnfC8RTyxgG+zxo0ZTDKA64hFOqxH+ABrKP+uyTa4OUFhcMSKQcodK1uw8RV8ZVBSwBoq13ucZ+w2xkDEbs/z7PpsdB06ge5d10UBd+rhNFGwFWLjYIx1FD2kD9WtEAJKqT9WStlRmgZ6mP5tJ9/SgIfDBrxR/34Sr0xCG4s2+XHasOwONpY+/f89g6WmSu06+2ERQsCVM0IqcDETV1+HWhv1U3KhdSPeM+QakzBYaMoz41ipfLkLtP562s9WSqM91s49yF1/yLBlIkyCchdSrpRdRUrpN9dfJT0GuGtDlXwZLb7OHr8A54UFaiNwdgQAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;7&quot; title=&quot;7&quot; src=&quot;/static/e32cb01c393fdf6f0c175078569002dc/914ae/7.png&quot; srcSet=&quot;/static/e32cb01c393fdf6f0c175078569002dc/2eb24/7.png 215w,/static/e32cb01c393fdf6f0c175078569002dc/05ed2/7.png 430w,/static/e32cb01c393fdf6f0c175078569002dc/914ae/7.png 860w,/static/e32cb01c393fdf6f0c175078569002dc/11a8f/7.png 1272w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Under &lt;code&gt;Description&lt;/code&gt; tab, copy your &lt;code&gt;Public DNS (IPv4)&lt;/code&gt; as you&amp;#x27;ll need it soon&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:14.883720930232558%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAlklEQVQI12WO0QqEIBBF+/+viE2lddXF1AXxVaOH6B8iqP7ibiP01MPhXoaZO7d5ixeIj5TgnENeKoSokDfGwHsP59yDYRges+ZrFAitNbquq0GkbduCMVYD72VrLVJKWNcV27bhPE8cx4F93yvkGx8CQvhd3xz6vodSqkLHFELtbqhRjBHLsmCaJszzjFIKcs6VcRzxB/oevQJ96tgzAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;8&quot; title=&quot;8&quot; src=&quot;/static/d510dde8385c4e3d23d53061147ad983/914ae/8.png&quot; srcSet=&quot;/static/d510dde8385c4e3d23d53061147ad983/2eb24/8.png 215w,/static/d510dde8385c4e3d23d53061147ad983/05ed2/8.png 430w,/static/d510dde8385c4e3d23d53061147ad983/914ae/8.png 860w,/static/d510dde8385c4e3d23d53061147ad983/65d79/8.png 905w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;2-connect-to-your-instance&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-connect-to-your-instance&quot; aria-label=&quot;2 connect to your instance permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Connect to your Instance&lt;/h2&gt;&lt;p&gt;Open your git bash(windows) or terminal(mac) then browse over to the directory you saved your key file. Then run the command to change file access (User can read only).&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/Downloads/aws-key-1022.pem&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then connect to your instance with your copied &lt;code&gt;Public DNS (IPv4)&lt;/code&gt;. i.e. &lt;code&gt;ssh -i ~/Downloads/aws-key-1022.pem ubuntu@ec1-4-56-119-211.us-east-2.compute.amazonaws.com&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -i ~/Downloads/aws-key-1022.pem ubuntu@&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;YOUR_COPIED_PUBLIC_DNS&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;3-install-required-packages-on-ubuntu&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-install-required-packages-on-ubuntu&quot; aria-label=&quot;3 install required packages on ubuntu permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Install required packages on Ubuntu&lt;/h2&gt;&lt;p&gt;Run the below command to install all packages needed to run the server on Ubuntu.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; https://ellismin.com/sh/linux-mern-setup &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What&amp;#x27;s in file: &lt;a href=&quot;/sh/linux-mern-setup&quot; target=&quot;_blank&quot;&gt;linux-mern-setup&lt;/a&gt;&lt;br/&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Add nodejs 10 personal package from nodesource&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -sL https://deb.nodesource.com/setup_10.x &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -E &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;bash&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Install Node.js &amp;amp; npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -y nodejs&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Import GPK key for MongoDB&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4B7C549A058F8B6B&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Add MongoDB APT repository at /etc/apt/sources.list.d/mongodb.list&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;tee&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/apt/sources.list.d/mongodb.list&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Instal MongoDB on Ubuntu&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; update&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -y mongodb-org&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Start MongoDB&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl start mongod&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Start MongoDB automatically on startup&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;enable&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongod&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Install pm2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -g pm2&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Start pm2 automatically on startup&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 startup systemd&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Install nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -y nginx&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Enable UWF--allow SSH with firewall&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ufw allow OpenSSH&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Allow HTTP/HTTPS with firewall&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ufw allow &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Nginx Full&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Enable firewall&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ufw --force &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;enable&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;4-set-up-your-mern-application-with-nginx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-set-up-your-mern-application-with-nginx&quot; aria-label=&quot;4 set up your mern application with nginx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Set up your MERN application with nginx&lt;/h2&gt;&lt;p&gt;Clone your repository into your Ubuntu machine. Note that I&amp;#x27;m using a project that was set up in &lt;a href=&quot;/2020/03/deploy-mern-1#serve-indexhtml&quot;&gt;this post&lt;/a&gt;. Client folder(front-end) is located inside the root directory that contains other the back-end code.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; clone https://github.com/EllisMin/mern-demo-production.git /opt/mern-demo&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Tired of github authentication for pulling repository? Create ssh-keygen with &lt;code&gt;cd ~/.ssh &amp;amp; ssh-keygen&lt;/code&gt; then keep pressing enter for prompts. Run &lt;code&gt;cat id_rsa.pub&lt;/code&gt; to copy the key &amp;amp; paste into github repository --&amp;gt; &lt;code&gt;Settings&lt;/code&gt; --&amp;gt; &lt;code&gt;Deploy keys&lt;/code&gt; --&amp;gt; &lt;code&gt;Add deploy key&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Navigate into project folder and install npm packages&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mern-demo &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Start the server with &lt;code&gt;pm2&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 start app.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Why use pm2? While running the server with &lt;code&gt;npm start&lt;/code&gt; works, the server may crash if there&amp;#x27;s an error or unexpected behavior occur to the server. pm2 allows to keep application alive forever by reloading Node.js application without downtime.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Tip: more commands for pm2&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# You can use [filename] instead of all&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 stop all    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Stops all process running with pm2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 restart all &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Restart all process running&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 delete all  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Remove all process from pm2 list&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 logs        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Displays log messages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 status      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Shows status of running servers&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;configuring-nginx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#configuring-nginx&quot; aria-label=&quot;configuring nginx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuring nginx&lt;/h3&gt;&lt;p&gt;Start off by removing the default setting for nginx&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, create a new default for configuration&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;nano&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;/etc/nginx/sites-available/default&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;nginx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-nginx&quot;&gt;NGINX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-nginx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80 default_server;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name _;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  # Path to front-end index.html&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location / {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    root /opt/mern-demo/front-end/build;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    try_files $uri /index.html;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Change the path to your project&amp;#x27;s build folder of client side.&lt;/p&gt;&lt;p&gt;i.e. &lt;code&gt;/opt/&amp;lt;YOUR_PROJECT_FOLDER&amp;gt;/&amp;lt;CLIENT_FOLDER&amp;gt;/build&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Making changes to this file requires restarting nginx. Restart it.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl restart nginx&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nginx restart&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Tip: more commands for nginx&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nginx -t                &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# check nginx syntax&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl start nginx   &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# start nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl stop nginx    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# stop nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl restart nginx &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# restart nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl status nginx  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# view server status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;tail&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -30 /var/log/nginx/error.log &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# display error log for debugging&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point, you should be able to see your app running on server. Navigate to your &lt;code&gt;Public DNS(IPv4)&lt;/code&gt; i.e. &lt;code&gt;ec1-4-56-119-211.us-east-2.compute.amazonaws.com&lt;/code&gt;. Alternative is to go to &lt;code&gt;IPv4 Public IP&lt;/code&gt; i.e. &lt;code&gt;3.22.154.213&lt;/code&gt;&lt;/p&gt;&lt;h2 id=&quot;5-set-up-your-custom-domain-ie-route-traffic-to-ec2-instance&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-set-up-your-custom-domain-ie-route-traffic-to-ec2-instance&quot; aria-label=&quot;5 set up your custom domain ie route traffic to ec2 instance permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Set up your custom domain i.e. route traffic to EC2 Instance&lt;/h2&gt;&lt;p&gt;Setting up your custom domain is possible through &lt;code&gt;Route 53&lt;/code&gt; service which is a cheap, paid service (50 cents per month up to 25 hosted zone). &lt;a href=&quot;https://aws.amazon.com/route53/pricing/&quot;&gt;Read More about pricing&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Go to AWS console and launch &lt;code&gt;Route 53&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:286px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:45.58139534883721%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABKklEQVQoz61Ry07DMBDMH3HgH/gjzpyR+BY4IC5cEAKB4JBUTRPnAU3i2nnjNqE9kWSIXRpQVSQQrLT2eHY9O5Y1/GN0XQdtUVXI8gJBRKGPxiCuD9MiGE9s2MQDcTw8B2GPXcXJutOnxPrIhNXzYTRD27ZKVFsuV3gRAkVZwnZc0BlHnKTIsqLHDIwnEPMF0ixXfJJmEGKudh4nisuL8lNwY5cxBofYf3+yXGSUokLICzxFscqQMtR1rWpyuuzbznbrrBx23dpqHtpwb07h3Z3Dv7+AZTygfl0NkzcXdrn6WtPa5k2BydkJrg73YBwfQD/ahzAvP9w134rtisFhHHgwH69BHQOufoupR9RHNE0zOPmh4LoxTnMElIPyFMSfqh8nxOkF218JvgOO+K/hlWpIEQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;9&quot; title=&quot;9&quot; src=&quot;/static/e63ca1d5bc31439a9023345f9cc3c3d1/357e3/9.png&quot; srcSet=&quot;/static/e63ca1d5bc31439a9023345f9cc3c3d1/2eb24/9.png 215w,/static/e63ca1d5bc31439a9023345f9cc3c3d1/357e3/9.png 286w&quot; sizes=&quot;(max-width: 286px) 100vw, 286px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Start &lt;code&gt;DNS Management&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:306px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:109.30232558139534%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWCAYAAADAQbwGAAAACXBIWXMAAAsTAAALEwEAmpwYAAADGklEQVQ4y41V205TQRQ9X2HiL/jqg08mvvlsYuKDL0YIJOoH+AGGxEQexRCiQI1cbW1LQkwwCshFBNvSK7Sn99KW3ihBSzn0nOWsgVNKuU6yM52Zvddea++ZUwUtwzAMtI9KpQKbzYa+vj6MjIygWCzKfV3XzahT/ko7WLlcxvLysrSVlRXY7XaMj4/DarXCZp3ElNOBSrl0EmNcAGhmXFpakiDRaBShUAizs7MYGxuTLD9N2DE1/Q2Z/E4by0sAySoYDDYd6vU6YlEV6VwJFbcFmvM+4OoRxBpHYq9iSKmBQOBMZtTTwMebQLAf+HwbhufNceDh5YCrq6sYHR2Fx+PB4uIiZn98x+JvD5J/bIDlBvTENIyxW8Cvl0cMzwNkcc2mUCJrNzMzg97eXnR2dmJyYgJef0hIfQXDegfG1wcwatvHkvVTt0Np7bDJslAowOl0wuFwyPmLaMj8/E8JoO9lpJ8usfQz10257A5eZ7THKa1yS6USXC4X1tbWZKfT6TQ2Njagqio2NzflrKoRhMNhWZZ8Po/2kimt6NVqVQayy7FYDKlUSjaJe3Nzc1hYWEAkEsH6+jrcbrcsTTtbRdM0NBqNo7qcc1GvGow/PDxsxiqUSQbxeFxKoVwyTCQS8Pl8Tdn8zTKQtdfrlS+JPjxjrClfyeVysh40ykkmk9KRQEzUuseZQEzMfQKxrkzEj4gEpBMvMR14QCbMataPbHnm9/ubdWUiAtOPMVw3JZMq2dGZTgTgbHY2m83KQIKaRmZkbHabMeyDBCxsb0uwhHBKJYWTACFrBhLUBORvsuN6W8SwwyRDY3nYnCOG4tDt8WJTjcIX3EAoLAKFQ0wkSGcygm0MEQEWENIODrQrL7lS/qvBldxFvFiDf2sPntQuapp+rRfSbs2X0tD1k6+vsL39BrLVA+Sqmpy3dg6QFZbf5VpDtdZoAhjGFX8BBHv4LoynHyLoGFTRMaSi2xJF13AUjwci6LLEcPe1aFxh//iDcsFbNgH/1Rt49NaHjgE/ut/78WwwgBfDQTwfCuBJv0+u7/WsyRKdB/gfkI1ZciBvXLMAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;10&quot; title=&quot;10&quot; src=&quot;/static/cf5550d1b76ff20e77423eaaf888af3b/98b92/10.png&quot; srcSet=&quot;/static/cf5550d1b76ff20e77423eaaf888af3b/2eb24/10.png 215w,/static/cf5550d1b76ff20e77423eaaf888af3b/98b92/10.png 306w&quot; sizes=&quot;(max-width: 306px) 100vw, 306px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;Create Hosted Zone&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:47.906976744186046%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAABSElEQVQoz4VSyU7DMBD1//MBnOgViT/gggSCAyAOBVRFhUMjlS7Z2jhktZ2Hn1WLtgQY6Wk84zfjWSxGNwucXS9w+ZKiripst1vIokDbtsjz3EEpBUpvDPq+/wFK13UIwxBCaY1OaShtYGyAtjbhz5V9ZDp9w3yVuUBj9GBS8lmEwID4V5lsuVxh8vqM4OoUUAX63f1QlZTBhN+JDSaTAE8Pd8D4BCjn/ubXGMH5eLBFas7D24WdZ5wkaLWdkzLW3x1wPGiTLxJLJuI4RpqmDlEUOZv+LMt2vjVi66ePto8hyKHebDYQ+4uQUrote7C6PJfO7zfuOV6zuv0cgoMn6ro+0ASDykLaxFZ/Wi1z96WOeURZlq5t0TQNCK58X/NPpraV2SLB+P0DQbhGlGSu6mO+P7PaP7dcdcDFY4Lz+xij2zVmaYv/5AuUiwWToOCQRAAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;11&quot; title=&quot;11&quot; src=&quot;/static/720c030169af7eeb7fda954b9555f755/914ae/11.png&quot; srcSet=&quot;/static/720c030169af7eeb7fda954b9555f755/2eb24/11.png 215w,/static/720c030169af7eeb7fda954b9555f755/05ed2/11.png 430w,/static/720c030169af7eeb7fda954b9555f755/914ae/11.png 860w,/static/720c030169af7eeb7fda954b9555f755/e3189/11.png 1035w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Type in your domain i.e. &lt;code&gt;yourDomain.com&lt;/code&gt; and &lt;code&gt;Create&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:468px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:61.86046511627906%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAABUElEQVQoz41Ti26DMAzk/z9v0gQU6CSgSAVKChQoj+JxVg9l7TTN0imOcS4X2zin3MhnkIgbpfLhfW1+rH7VrWIGEdO/4CWmeU+/bBdxbrebXK9XqapK0TSNojJG17quFfTNlls/fcS6rtv3j8dDHLMdjKJIXNcV3/clTVMJgkD94/Go/uFw0O/wkRuG4YZAPM/TvCRJlFwJ+76XeZ7lfh9lmiYZx1GBjzT4y7L8AM4w3851ECiKQm+N41hV4Ol4yvl8VpRlKZfLZT9sE9DWdVU4wzBoALfaHxFv21aBOgNQhDwQkoDguZ0QilAfIM9z+c1w4C+F+mQSIglPogoq4UoftbNjr0p3QhoUoqZoFpSiflgBvMI2EEOEbTshb6ACzBUagmZgJTkuw6ihcdyjzmzaGyEtyzLtPGcPc8YfgMOOPeIgRBzleiMkWEfW9L/2DWYNnu5muGz3AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;12&quot; title=&quot;12&quot; src=&quot;/static/ae8fd25f41507a44dc1d50db79761481/90372/12.png&quot; srcSet=&quot;/static/ae8fd25f41507a44dc1d50db79761481/2eb24/12.png 215w,/static/ae8fd25f41507a44dc1d50db79761481/05ed2/12.png 430w,/static/ae8fd25f41507a44dc1d50db79761481/90372/12.png 468w&quot; sizes=&quot;(max-width: 468px) 100vw, 468px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Copy these 4 values, &lt;code&gt;ns-....&lt;/code&gt; then navigate to your domain provider. i.e. &lt;code&gt;namecheap&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:507px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:28.37209302325581%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAABSUlEQVQY02WPW0/CQBSE+/+fjGiBhqW7vUDBlihFNBgfVCIItDQUEAiXhmAIJD75A8azNcYYHr7M7J6T2VmFcx2ZzDkYY7BME6ZhnCDvNU1DLpdNvapeIptVYdDMECJFCJ6qUhS0XNDBdAO6YUEX1o/+Qmdu2CjoAjmNoXn/gCAao9sLEZIGUYx+OEIUv+Ou9QjFchsoeU3Y3i1sV9KAdeX/wyTkDneu0R5MkRy+EEw2GM62GIzXCKcJJqs9nt5iKMz2cKEJnKkMmTyHWqBvV+sURJBKLx/JMht5XqbACWbJEd1ojkG8SrUfLzFa7NB67kHhzg2KFCqDpeqlWhpiVv0/qKGgdsxy8UKB080BAbXqDOcUuKC2CabrAzrkFcerw/F8VGp+qpKyWz9Bzq1KDe1ehM3HJ95XO4xmG4znCRbJHsvtEa/9Eb4BqtZ1b3SD2g4AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;13&quot; title=&quot;13&quot; src=&quot;/static/23798637e79b0e3824fcff1884c42a66/3ebb1/13.png&quot; srcSet=&quot;/static/23798637e79b0e3824fcff1884c42a66/2eb24/13.png 215w,/static/23798637e79b0e3824fcff1884c42a66/05ed2/13.png 430w,/static/23798637e79b0e3824fcff1884c42a66/3ebb1/13.png 507w&quot; sizes=&quot;(max-width: 507px) 100vw, 507px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Paste in copied values into Custom DNS name servers on your domain provider&amp;#x27;s website
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:779px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:26.51162790697674%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAq0lEQVQY02WQ6w6DIAyFef9nNGQRMf7SRS4iAmelmwtqk5O2lH4tiEGP6DqJvleoZoyBlBKpFBjvEWLk80L5kRIeRueFXEoHyuYgnPNYVwPnHNdjPDiOBDLWotYdgfd9R86ZwQ/9BhIV4jqs/ONlWaCUwjAM0FpjnmceEkJgePU1b3tqJNpJLfRNwBM2TRNvfYJaf+kjieeXfC/4l4QdNWuzBqk+l5Rvui/yAZgehvj+PCEXAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;14&quot; title=&quot;14&quot; src=&quot;/static/d785355d495c53a05b4615eaae341515/96e92/14.png&quot; srcSet=&quot;/static/d785355d495c53a05b4615eaae341515/2eb24/14.png 215w,/static/d785355d495c53a05b4615eaae341515/05ed2/14.png 430w,/static/d785355d495c53a05b4615eaae341515/96e92/14.png 779w&quot; sizes=&quot;(max-width: 779px) 100vw, 779px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Changing name server may take some time depending on the domain provider&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;6-set-up-your-ssl-certificate-https&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#6-set-up-your-ssl-certificate-https&quot; aria-label=&quot;6 set up your ssl certificate https permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;6. Set up your SSL certificate (HTTPS)&lt;/h2&gt;&lt;h3 id=&quot;certificate-validation-with-domain&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#certificate-validation-with-domain&quot; aria-label=&quot;certificate validation with domain permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Certificate validation with domain&lt;/h3&gt;&lt;p&gt;AWS &lt;code&gt;Certificate Manager&lt;/code&gt; provides a free public SSL/TLS certificates. On AWS console. launch &lt;code&gt;Certificate Manager&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:389px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:57.674418604651166%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAABg0lEQVQoz5WSzU7CQBRGeWEXrvAlTEyMxrgywYUrXaAsXZq4g05LS/+nxZY2BaTQAIX2c6aAQgkGbtLcyTT3zPmmreR5Dl7foximRWHaFB3NgCgpUHlvKxDENjqqDs2woLBOJBktIkFWVEySBOliweZHiMdjVDZA3vnTUTVE/f56D3vFt+ZpigWDpKzzmfl8jlEcr4AbGK/lcgndMOB5HgaDIXy/x9Y+wjCE63bhuC6iqL93yGwbuDHjlWUZDMOEJLVhmhYbjhAEAYMPCrhNKfq/9n9zs0OGBZCBZFkBpU4RKV3H24m9dU3/Anlky7YLSw7UdQPNZquIujmwfOdHGJogRERLIHAc56DVcYYMyG0syy5Mp9PpznAZelxkZiiKhMXW4VAbvvcFIghIksnphjyyRn1oTgCV9qC5YbGW9C7C4QQ5e3+SYbZcoPNeg9y4RfPlCsrbNcTXGyj1K1gfz8jy1a99AjCFVr9E6+Ec5LEK7ekCQq2Kz/sztBt3K0jpS5eBP6QgklFS06djAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;15&quot; title=&quot;15&quot; src=&quot;/static/2a2beee79a02d67a292c7edc1105314a/00a4e/15.png&quot; srcSet=&quot;/static/2a2beee79a02d67a292c7edc1105314a/2eb24/15.png 215w,/static/2a2beee79a02d67a292c7edc1105314a/00a4e/15.png 389w&quot; sizes=&quot;(max-width: 389px) 100vw, 389px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;Request a certificate&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:348px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:45.11627906976744%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABtklEQVQoz3WPW0sbURSF5zfpU33yhm1/g4hCoRpNwXgBnwKBBPKQCyImZHKbmVxmzkzM1UeND+YhVkkUNIpBVGiahPY/rJ59kgGx7cPH2mutffYwUr1+itvOAy7ad/h+TXRwdTPiot0Rnrq7+wfUz85gHpVRKNdgFmuwSjUxkzLuTa5Ss9mEq/gbK1oPDmOAr/k+ljXiJzZYHxtGH0tqDzulX9iTTzC5msCMS8XcloKZTQVTzjRmXQo+7SiY4yoOOtQuFg+usK1eY01uYTnS5rTgiLfgTHJ/eIlv2S52D48xsRLC9No+PjvDmF4N48OXEOYdIXxcD2OBIzUaDfQHQzw+/0D3hejh6XUEzQR1g+EQ5+cN6MyCVSyDFUpg/PetI5rLMAojlSqVCizLhMkMWCbjcGVjTBsGZhhgjHpzvPdvpGq1inxeh6ZlkMn8jTbmf9n7Xhw0+NfJ5HI5QTabFdjezt7uvMd+Iw5SoOu6eKCqqoDmQCAAt9uNYDCIWCwmsmg0Co/HA6/XC7/fD5/PJ4hEIkin06ODtEhGURShNslkErIsI5FIIJVKiYyUsng8LnJSwu7/AJLtD3hFzSpPAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;16&quot; title=&quot;16&quot; src=&quot;/static/1a446da15460bb7e81b10caee534e1ff/34ea4/16.png&quot; srcSet=&quot;/static/1a446da15460bb7e81b10caee534e1ff/2eb24/16.png 215w,/static/1a446da15460bb7e81b10caee534e1ff/34ea4/16.png 348w&quot; sizes=&quot;(max-width: 348px) 100vw, 348px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Select Request a public certificate then &lt;code&gt;Request a certificate&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:32.558139534883715%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAnklEQVQoz61RSwpCMRDr/S/gziN4BReuvYXYLiqPvmkt9hdnWh8KuvFpIITQmZChapomOOdgrYX3HuvQ0NqgOp0NjNHQWkPChRI8E3UlGgwhdL+of/UxI5Xag5WbiReot8w5I8Y4Fh7DzrO/3lD4LaXcZ55MQzmscjuBwh/RT15u/4WlNm459C3wmzafoNaeJpBG8iG74wWbvcb2YHAHe0QmN8ws53UAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;17&quot; title=&quot;17&quot; src=&quot;/static/69c2bb96b74d74fd63e2c6e09fddf31a/914ae/17.png&quot; srcSet=&quot;/static/69c2bb96b74d74fd63e2c6e09fddf31a/2eb24/17.png 215w,/static/69c2bb96b74d74fd63e2c6e09fddf31a/05ed2/17.png 430w,/static/69c2bb96b74d74fd63e2c6e09fddf31a/914ae/17.png 860w,/static/69c2bb96b74d74fd63e2c6e09fddf31a/b5dee/17.png 1237w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Choose your domain(s). i.e. &lt;code&gt;yourDomain.com&lt;/code&gt; and &lt;code&gt;www.yourDomain.com&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:45.11627906976744%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABB0lEQVQoz41SR27EMAzU/w/5TC75Rc4+udtw721VGA0DCd4ESJbAgLREUzMjiWEYKM9zKsuSiqKgcRwJoZQirTXnO6SUvzJwXRd1XUfi50DUaZp6ZFnm9xzQ42r0tG1L67oyEXEcB/8Qx7FvrKqK13g9immaJjLGeNYO7ht7CGSBAjKDIOChy7LQPM8M1Dgd+b/AMD8QLCG973vatu17U1tGUrE3jsErwQPBJgxDiqLI+5YkCZ3n6eUZ8yz1fmkue4b7vrNvTdN41HXN3i32sGm20seVdqsEjHEQcK8BDBV/0feMLKS14BXhAtcNRnhDuABk4Nk3w3DG3yGVpuuh6P2zpbePlL4AEpW4l8C4n5cAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;18&quot; title=&quot;18&quot; src=&quot;/static/4fbe30035d357bd1682613001b13a662/914ae/18.png&quot; srcSet=&quot;/static/4fbe30035d357bd1682613001b13a662/2eb24/18.png 215w,/static/4fbe30035d357bd1682613001b13a662/05ed2/18.png 430w,/static/4fbe30035d357bd1682613001b13a662/914ae/18.png 860w,/static/4fbe30035d357bd1682613001b13a662/c0255/18.png 920w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Choose your validation method. &lt;code&gt;DNS validation&lt;/code&gt; would be available through &lt;code&gt;Route 53&lt;/code&gt; or other domain name providers such as &lt;code&gt;Namecheap&lt;/code&gt;, &lt;code&gt;GoDaddy&lt;/code&gt;, etc.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:46.97674418604651%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABEklEQVQoz51Sy26EMAzk/3+plx576K2XSpUo4iW0GzYEAkteTGOrsCzi0loaPDZm/BBJ27aoqopRFAXKsmROnuK6rp9yFBPWb5qm4Tri8zwjUUrh1goIISClZE9N6KW1doNz7jQmb4xhTpbQox8di3RdF6OFEUKA956x5/vcitWWZfkV1BPSNEWWfaNqrqgvEqrvoWIDatITj5sQukNuGAZu8CTonOUCQljwLyOxbeVpuiPPcz463fAW1xftDRch0anY6GSyNaa7j+MIHycJjwkdF2mtt0LVR64NjHUIh/vxDfmOfptstYQSx+TZOnvwED7AuMDTjXrA66fCe6Yfgn8BmY1idxN4ZfrtXj6uePuS+AF6a7mtqm/RGgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;19&quot; title=&quot;19&quot; src=&quot;/static/09ce60c6346b0d3ff3f295820943057c/914ae/19.png&quot; srcSet=&quot;/static/09ce60c6346b0d3ff3f295820943057c/2eb24/19.png 215w,/static/09ce60c6346b0d3ff3f295820943057c/05ed2/19.png 430w,/static/09ce60c6346b0d3ff3f295820943057c/914ae/19.png 860w,/static/09ce60c6346b0d3ff3f295820943057c/59822/19.png 916w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Click &lt;code&gt;Review&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:32.093023255813954%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAqUlEQVQY041P2wnDMBDz/gN0k/52h85QMLQ4Dgl+1Y+o0QWHfJQQg5DO6IROGWOgtcY8z0gpwXsvHEIQTY4xCndw3v/iupMKSm1YlgWKS9M07cvUBLVzTnDU9HWv5xwSXKwSyCeB4ziitSaotUrbPhNXnzTkedZa5Jz3gFKKBPeZxjM0om2sGMRTehMaOp9hdfxtqY51r4Jh4VsRU8ZgPni9LW4PjftzwA8zH9YR0OEmUAAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;20&quot; title=&quot;20&quot; src=&quot;/static/b425f26213958dd6f10802ab8e8e2f7b/914ae/20.png&quot; srcSet=&quot;/static/b425f26213958dd6f10802ab8e8e2f7b/2eb24/20.png 215w,/static/b425f26213958dd6f10802ab8e8e2f7b/05ed2/20.png 430w,/static/b425f26213958dd6f10802ab8e8e2f7b/914ae/20.png 860w,/static/b425f26213958dd6f10802ab8e8e2f7b/0eb6d/20.png 913w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;Confirm and request&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:58.139534883720934%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAAA80lEQVQoz6VSyQrCMBTMP+vJL/Ig/oYX715caEuxxdZu6b6MTrASMUKLD4Y0DcybN/OEbdvoug6sYRj+hojjGFEUoWka9H2vyHXw31QoQt/3EYYhkiRBmqbIsgxSyvc5V7nAq3hhFxKRuCxLRciTb1NL6BeObVkWHMdRqj3PAycoimKyUkGStm3fwZhqlkLXdZWSIAhQ17VCVVUKbDZ2nhxKnufKKz0Igj7ybfba6HIZAJVylUiq76fZim9fxfjBIgFHHn3lGCY/dUDDB6FJhWmkn8GNoczxp3sqvssGcSphX47YHa5YrM9Ybc5Yrk/Y7m94AEASrmxCz2moAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;21&quot; title=&quot;21&quot; src=&quot;/static/61448759985715116d5229119bb2c059/914ae/21.png&quot; srcSet=&quot;/static/61448759985715116d5229119bb2c059/2eb24/21.png 215w,/static/61448759985715116d5229119bb2c059/05ed2/21.png 430w,/static/61448759985715116d5229119bb2c059/914ae/21.png 860w,/static/61448759985715116d5229119bb2c059/e4374/21.png 927w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;(&lt;code&gt;Route 53&lt;/code&gt; users): if your already using &lt;code&gt;Route 53&lt;/code&gt; with custom domain pointing to your EC2 instance, simply click &lt;code&gt;Create record in Route 53&lt;/code&gt; button(s). Then you&amp;#x27;ll be able to view created CNAME records in your hosted zone
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:68.37209302325581%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAACdUlEQVQ4y3VTW4vTQBjND9dH/4T64O1FEBFZQUEUXMEXZVdFbHdrS7dt0iSTpJmZ3JMezzfZiLJYOCSdfLdzvjOe1hpBECBJEvRdB+CIYRhu4nhE35RoDwHho28rnv8be2SMl6YpDocDlFIIVYo41bC2QFFYSLOyLB2MMaiqGrasHIy1PNOMK1yc5f+maeBJscvLS/j+Dv4+gh/GnDaFNMqyDHEcO0ii7/uIowg5c4SRxAjkXer0fQ+vaTts/QAqZbJKEHFSmTZRY0JGKBaU4DAMMZvNsFwusd/vXSOJlac0d5SbXFGTCL1JMNgErU6Q57mDUMmJmFJoUhba07nIIFOPsChIuW1beK/ffcf9l+d4fHKGB6++4eTNF0SrBa52O2w3G04fYrMnpVy7RGuN08tcN5B3W1DTsh4pv/+0wIvTFU4+rvD8wxJvT+doMgV9nWQJrfNxElmO5ZJkOVycFJNJbdWgqHv03LSHxqLTygHVgbYZ8N/f0AJlimOR0F39jc9Ow5gbDcIIu2DPLVPkTHMi43SSzTlKhHb0qGGqkJPB4ZARuWMhcfLd2SblysXYYodQZQhTJhblH9EnvaaiZVWhqhtHf/KoxMlztA2rzudzZwOxx57FxW/yP2KT7XaL9XrtusvzgrFyNsUF10+xjtwWrygtP/r0nOIUpEv3y0a1s8e4jJwSVHXtqG24efGjnBszSmPcTTHoeHW9q4tfWMwW+PWTmC+x+jFDsF5hQ9vsdltqG2LtK6TUS7w2ee9v2xhu3FCmriPle8/OcOvhOe48OcftR19x9+ln1NEOCQtMV0swJYuxnZ5aO0gTU7Yw9UDbHPEb98Qkws6rwIoAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;24&quot; title=&quot;24&quot; src=&quot;/static/82ad44968f1e9db721cfe911f94d649d/914ae/24.png&quot; srcSet=&quot;/static/82ad44968f1e9db721cfe911f94d649d/2eb24/24.png 215w,/static/82ad44968f1e9db721cfe911f94d649d/05ed2/24.png 430w,/static/82ad44968f1e9db721cfe911f94d649d/914ae/24.png 860w,/static/82ad44968f1e9db721cfe911f94d649d/0955e/24.png 901w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:20.930232558139537%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAECAYAAACOXx+WAAAACXBIWXMAAAsTAAALEwEAmpwYAAAApElEQVQY02WQTQqFMAyEe/87KAguatGWitVjuOrOv1bBhb3DPBKoPHDxMZBkZiCi73t0XQdjDIZh+EB7ay2qqmLatsU0TXDOvYzjyEr3gsKapoFSClrrDxRAu6IoUJYl6rrm++whpJSsVCzO88RxHFiWhZWIMTIpJVzXxWzbxjf/5Nl935jnmctFNocQsO871nV9g6ksB9KOoHnW7HmeB957ftsP3HAI30cbGiwAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;25&quot; title=&quot;25&quot; src=&quot;/static/ced190cf901a17006856f26d02647ef0/914ae/25.png&quot; srcSet=&quot;/static/ced190cf901a17006856f26d02647ef0/2eb24/25.png 215w,/static/ced190cf901a17006856f26d02647ef0/05ed2/25.png 430w,/static/ced190cf901a17006856f26d02647ef0/914ae/25.png 860w,/static/ced190cf901a17006856f26d02647ef0/f2d92/25.png 1027w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;For those who are not using &lt;code&gt;Route 53&lt;/code&gt; and their domain name provider allows to alter DNS record, create these records accordingly
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:88.83720930232559%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAACXBIWXMAAAsTAAALEwEAmpwYAAACoklEQVQ4y21TXU/bQBD0L63UP1L1Z7QqiRPbsePYceLEiQSBPjUFIV54Iw9UCAgQ8kk+gbRMbzZcCCiWRrden2dnd+4My7KQzWYRRRHiOEa5XBaUSqV3sca2nIbrujBs24ZpmkilUshkMkin0wLmHccBCzLWq21bEvObzmuwkEF1fPE8TypwYz6fF8XFYnENvodhCFft89R3xpvf9R6DZFSYy+UQBKFI30bGfMHPw0p9h53+hsD31ns1uNegTFYLgkBtiNYz2pzTJnEUFhAFvvonWKvUK/cabE/mp1SaWRtpy1Ut+QgKBWmdRu3t7aHRaGB3d1fig4Ofam1IjmBuf39f5Q9gVKtVMYGzFBNk8LaMgLnD34fo9Xp4fn7G/f09/pyf4/b2Fp1OR/L9fh/dbheTyURig23QDN/336GgFDJ/cnKC4XCI6XSKh4cHXF1doX19LbnRaCTQ3+/u7lYta6ftV3U6Ns00fjUP0RnM0B+OMZ/PMV8ssFg8SjybzQQke3p6WhFykFREYqpKkgT1el3A+bVaLayfl7/AYoSXeR/4t8THhyMw6A6JNELtpgKLnJ6eYrlciqJHpW42nWA+Hat1KuqYp0LOmLM1qO7Hzo60l3l12fXycowcJ4fj42OZHcGhDwYDjMeTdzNkjqQ3Nzcw2CKPDQ83b4u+UnTZtmw0m030lIva5dbZGdrttjhLp/U6Ho/fWtb3li1vzpMuHx0dybC5mYQXFxe4Vi7znWTMkZAqLy8vYfBHx1kRElSmY8LLqyLFGFE5FsOSpCYrzy9RqVTWca1WU4RRjKBUQfiKciURd7UxvFb6mjGvf/6IJFFQq1GOFckGYlWRVXmXSbCJrURUqVCKVzBWbVTfINWSrdhGWK8lcIMyPn1J4/NXE/8B2bKDlB2RERIAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;22&quot; title=&quot;22&quot; src=&quot;/static/2ee9538fe5b47a8ea23d9cff9fa76fc2/914ae/22.png&quot; srcSet=&quot;/static/2ee9538fe5b47a8ea23d9cff9fa76fc2/2eb24/22.png 215w,/static/2ee9538fe5b47a8ea23d9cff9fa76fc2/05ed2/22.png 430w,/static/2ee9538fe5b47a8ea23d9cff9fa76fc2/914ae/22.png 860w,/static/2ee9538fe5b47a8ea23d9cff9fa76fc2/c6bbc/22.png 910w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;After setting those records, it would typically take about 3-10 minutes to be validated&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;If &lt;code&gt;DNS validation&lt;/code&gt; somehow does not work out, try validating with Email address--Amazon will send verification emails to your registered emails with your domain provider.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:46.97674418604651%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABDklEQVQoz51S2XKEIBD0/1/yP3nIX+Td9QJPwAt1wV6GFWMqlVRqrWp7BO3pdog456iqCkVRoCxLz0IIrOsKrfXJy7KcfAXth71t2xDVdY0kSTziOMbtdvOcZRnSNAVjzNfUiDjPc4/wTCaICeM4IiJlKoZhwDzPvpPWM/Z9xytXRDeyHbpeY1KD0CTU0zSda6E2xngxMuEFKTuJFU6U1x1Y02MYp28C/xa0LpkcN0gp0LbtS1HpmyeOyHr5ikxD4JyhYO5n8wZtJ9H3CkJKP32lFNRRE7qu82vGWFhySMrW2vMIPIdCx8PVq8Hd/HT8V4Yo2P0lDOW5RDredbg7R9NiIFUP0XB8fDZ4e8/xABZbuNlCRZMPAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;23&quot; title=&quot;23&quot; src=&quot;/static/f58f602b3706438bf6aca7219c6a61e2/914ae/23.png&quot; srcSet=&quot;/static/f58f602b3706438bf6aca7219c6a61e2/2eb24/23.png 215w,/static/f58f602b3706438bf6aca7219c6a61e2/05ed2/23.png 430w,/static/f58f602b3706438bf6aca7219c6a61e2/914ae/23.png 860w,/static/f58f602b3706438bf6aca7219c6a61e2/a2b88/23.png 908w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Once you&amp;#x27;ve had your certificate validated with your domain, move onto the next step&lt;/p&gt;&lt;h3 id=&quot;create-load-balancer&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-load-balancer&quot; aria-label=&quot;create load balancer permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create Load Balancer&lt;/h3&gt;&lt;p&gt;Load balancers, in a nutshell, accept users&amp;#x27; traffic and reroutes to the right server.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://aws.amazon.com/elasticloadbalancing/pricing/&quot;&gt;Elastic Load Balancing pricing&lt;/a&gt;--this is pretty cheap &amp;amp; your app should have it anyway.&lt;/p&gt;&lt;p&gt;Launch your EC2 instance and click &lt;code&gt;Load balancers&lt;/code&gt; from EC2 Dashboard then click &lt;code&gt;Create Load Balancer&lt;/code&gt;.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:700px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:51.627906976744185%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAABaklEQVQoz5WRy07DMBBF8//fUIqa2Hk4fsZJPwOJ1wK1AokNKlKhaiq6vIzdpKUIIVgcORmN79y5TlieQyoFpRVqKSHq+t+EeyNJVQlMJhNcTKcoyxLGGCgaoLX+FTWcQghkGQPnOfKiQFLThCzLIpImOOdgrf0TztmDaHBZy3g/CYWqqlCQO8Z5FE7TDIxxmsrjZMYYcoqG53msh//ZLI1iXdehbdvjmShtkAmNrFJICWksvG/QNCccIZTBrKSctT3UaJPvPZZqiabMKmVRSIOSiA3en5rp27oGhqi0o4se88HNVzwR+qLDyyK4oyxI2DXn7jwJSqVxdXOHx9UGTy9rbLY9drsdeiKefY+P/R4Pi+XJoTIOXevPxEbB0HN9e4/Ve4/n1zesN9ujYP9FcLEMguQwuCvGdX/A0SrKOhTKgUsabmnteRcfYqQlLMURBZk4PEwQluTUn2XYQFsXo2ip7geOWY8M23wCXDVtVr9QxgUAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;26&quot; title=&quot;26&quot; src=&quot;/static/b17221ea78e5f3c494acabc33514c8f3/8c557/26.png&quot; srcSet=&quot;/static/b17221ea78e5f3c494acabc33514c8f3/2eb24/26.png 215w,/static/b17221ea78e5f3c494acabc33514c8f3/05ed2/26.png 430w,/static/b17221ea78e5f3c494acabc33514c8f3/8c557/26.png 700w&quot; sizes=&quot;(max-width: 700px) 100vw, 700px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Select Application Load balancer for HTTP/HTTPS
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:434px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:117.2093023255814%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAXCAYAAAALHW+jAAAACXBIWXMAAAsTAAALEwEAmpwYAAADdUlEQVQ4y31Uya4bRRTtD+BfWCAFCTbhO1iwYVAWSPmFIISEkNiwiFgRSAQSC1AekdiAICR5yUOJwhD383OP1bPdo4e22223D/dWv3Zs55GWjuoO55665SpfZT6fwzAMieFwCF3X4QgB27bJ1mBZFlzXhUfo9Z6B+U2zxmq1wnq9atcdW5lOp9BJLAgj2I4Dy3agmwLCCyR004YbhDAsB64fQjMsWMKVvka50zMNfc2EcH1qyoQyIcEkCjBNIxRDjzqokYwrFNMKcT5HlJYoZksZy6dLxMUCUV5hVFQo5ysktKaUm5Q1xRdQQN+JEePLuwa+Obbw1QMLXx/buPlQSNx6JChu48YDG9+ekE8xtiXO4wzm5LOqFfzwu6dQ3v4BypU7UN4/gvLeEV79+C7e+vwYb352X9qvffIH3iD7MsVe//QeXrn6M5R3b0P54CfJV64cQfWyVtAMU9zrCTzqu3h42oLtk3PceWLixz8N/Pq3jccDT+Y67u46m1OHGxKs5iXmkxyLafECenYEN0qQphlUMYRHdl2Oib/PY1/eMnfIFzOKEyRpijhpkWcZTkUkYXhD/GuGJBbjsRYgHO1zO9R13Qry00mSBBmJMFIij4sMfxkhgmGC35+5dGRLiqsEEcYo8pa3W/NSQS6wg5HsyCdRFhk4Q+l3Qi8V3E22hAw5iQ6cCLrLnY7QFwECOu5hdxcKxnEsgx2443GeomeNcP23EF/84uPGfbog6jTPOJ/u8beCm81GGnxDu1jWK9pqg+9PIly69gTvXP8Hlz56CtUtKN5Qfr9muVzS/3ndCrJRVZUMsjjbPASqxQKzcgER5dDcGE6UEafe8johtlmnaZr2yBw8OztDv9+HaZpy7eB7HnxXwBj0oRN4+jCXeZ3Nk4qb2gpyRzy22pGlS4JDkyeKIiqyIYRDvks5YzvqeKQJGnNFUWAymbDMviDv6FE3LBoEgdydCzRNk+hyvJGcmbT6vo/ZbIayLOXF8rH3jsyFLMRkLuYjc6zzuTPO8+aDwUCuqqrKPHe6J8iFLLr7uzzfxJYCqnoq/e5ZMfi58eVsj8yqHODHuftv6exxkWNCmE3H8v2laUIX0ODwY7GtIBv/9+XlGna8gJdW8LMlmk0b57pD7AleRJDdUzeLmt7pOZqmyz0X7TZ4ocMu2X2H/kXxQ8H/AHcDoaY2AhtNAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;27&quot; title=&quot;27&quot; src=&quot;/static/bc0608476f51037feddd52298ebaa3d7/ade6e/27.png&quot; srcSet=&quot;/static/bc0608476f51037feddd52298ebaa3d7/2eb24/27.png 215w,/static/bc0608476f51037feddd52298ebaa3d7/05ed2/27.png 430w,/static/bc0608476f51037feddd52298ebaa3d7/ade6e/27.png 434w&quot; sizes=&quot;(max-width: 434px) 100vw, 434px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;If you&amp;#x27;d like, read more about &lt;a href=&quot;https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-balancer-types.html&quot;&gt;Load balancer Types&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Name your balancer, &lt;code&gt;Add listener&lt;/code&gt; for HTTPS, and check all availability zones. Then move to &lt;code&gt;Configure Security Settings&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:73.95348837209302%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAABbElEQVQ4y5VTi5KCMBDr//+khwoUCqU8CghKjuzYG87Dx3Ums1hpNpsUZQsNo08o8xTWtThpg6rxmOcZwzBgmibBOI6yF+r1esXeUnGcIE5SfH1FcK5CXTt0XfdziPURbBDqFtxT1pbItEaWZSgKg7K0sNaibVv0fQ/vvYDPAdvf2/+pXlGmc24db4Q21UpYYlmWX/jPUmQlISV734tve2NyPTbagzLGoGma+8F9b4hnIfxRqFf/zucz0jRdPSzABnuI41hqXdciYA/0XZEsiiIh5LiXy0XM3VYaztBIxme+9wi+xzAVVVVVhdvt9jSAT8OhLULIZKnm3WLTV5BQOCrHTpIE5d3D0CTPc6nc4xS88PSKdQt6R/A+KibIg7w6WV6Kn8fjEYfDQTwhAb2jRx+lTJkcl/NP8yIHqZBkbEay8Cl+dA+37E03olkJmCjHJHkYheQhmFcBqW2CfphEDUemt1ROYtoRFL4j/AYfW4/fklUMiQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;28&quot; title=&quot;28&quot; src=&quot;/static/7eaefe872c139788ecb80d4573ec7c93/914ae/28.png&quot; srcSet=&quot;/static/7eaefe872c139788ecb80d4573ec7c93/2eb24/28.png 215w,/static/7eaefe872c139788ecb80d4573ec7c93/05ed2/28.png 430w,/static/7eaefe872c139788ecb80d4573ec7c93/914ae/28.png 860w,/static/7eaefe872c139788ecb80d4573ec7c93/8affb/28.png 1254w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;This is where you connect the certificate to your balancer. Select the certificate and move to &lt;code&gt;Configure Security Groups&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:40%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABF0lEQVQoz5VS2W7EIAzM//9hn9ps2JycCRAIJFNDq1WlbrUq0sg2AyMPplFmw6w2CGUglx5T32IeOvgQYUOCjxnHkRBCQEoJ+75TfdT82Wq6joF1HW63Fh3FdTUwxtRLuC6cOSP/gSL6E/k80cxcgt3vYIyhH0aM44hlWUh4hdIamsSttU/hnHvEjeIeE5rSZiQ7MXiymarwrf2okfOlHv7PIsELLp7odQTjFm8dx/sgMNG7mj1D+wTlDkgXH/kzSJ+xhfOrw4lstwPHJGlA2kKuHnLz4MaC19pBUD6rte6JWrvKlbrw3B4kmNEopaAJq9E4Ynhh6HptOcYIIQSKsPc7pJQVZdLlqxT+pOkVXGXq3/lvEEf8J4+pbDlP4lruAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;29&quot; title=&quot;29&quot; src=&quot;/static/f5021b499e12c58a7d6b106a846bc14e/914ae/29.png&quot; srcSet=&quot;/static/f5021b499e12c58a7d6b106a846bc14e/2eb24/29.png 215w,/static/f5021b499e12c58a7d6b106a846bc14e/05ed2/29.png 430w,/static/f5021b499e12c58a7d6b106a846bc14e/914ae/29.png 860w,/static/f5021b499e12c58a7d6b106a846bc14e/9239a/29.png 1246w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Select the security group that you&amp;#x27;ve previously when creating EC2 instance i.e. &lt;code&gt;launch-wizard-1&lt;/code&gt; then move to next &lt;code&gt;Configure Routing&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:33.02325581395349%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAAA+UlEQVQoz31Qi26EIBD0/3+xNfVsUq3oIW8UZW6X0/aaXksyGQZYdmarSXtoF2B8xKgcrqS9VdBSwMwCyxKhQ4JfEmIMCCEQR2zbhmerai8N6rpG/fqCS/OGrvuA0QoxOHhnCBbBU5MDzrmnsNYWrqSU0FrDOg8pZyilYYzFtu/IOROAnfb7ng8+z7/xw+H9ZwtJUcdxQt/3mKapxFrXtXBKqUR8ZL47eZ5nDMNA9SNFbluK2UErRc4MhBAFijQ/aJqmaN6f4Ib8yYkr6Uv7js9BoOLcj9bZEY+Ao7EbbsIp1NGQmfVXzVEXUsa6ZVQs/prHf+v3HO+4AStYHxM5KudWAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;30&quot; title=&quot;30&quot; src=&quot;/static/3f33f494c52b7e2db227752ae74dbcd2/914ae/30.png&quot; srcSet=&quot;/static/3f33f494c52b7e2db227752ae74dbcd2/2eb24/30.png 215w,/static/3f33f494c52b7e2db227752ae74dbcd2/05ed2/30.png 430w,/static/3f33f494c52b7e2db227752ae74dbcd2/914ae/30.png 860w,/static/3f33f494c52b7e2db227752ae74dbcd2/91608/30.png 1251w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Set new target group with a name and select protocol as HTTPS for target group and for health checks. Move to &lt;code&gt;Register Targets&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:47.44186046511628%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA6klEQVQoz5VS6c6DMAzj/V+SfdpVBpSjJ+XwVwcxbf8GkkmqNo7jtuh1jb5+oH098Hw1ULWG9VHQGw/jAuyoMeoKzjkMNq+dR/AeKSVM0/SFoiwvKC9/uN3uGVdUlULfdWiaRoqmGBFj2GMIkgeJET7vE1wTzAtjDNq2FXZsW97YD83z/MaZr+CP7EopGOvwVNWbkCMxbrnRryj2BJnEIcSEbjBZbfzqyjOnFK7rKoanNEFrDdrwafQZUvFwHEdYa2VEgsVscuAg/Glk+kdS3irJSPypjrd5ykMWyfsaBlFK8kPZsiwSzxD+AxnDwXCIIaEHAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;31&quot; title=&quot;31&quot; src=&quot;/static/4776f353d541b3599761a6bb1487bcf8/914ae/31.png&quot; srcSet=&quot;/static/4776f353d541b3599761a6bb1487bcf8/2eb24/31.png 215w,/static/4776f353d541b3599761a6bb1487bcf8/05ed2/31.png 430w,/static/4776f353d541b3599761a6bb1487bcf8/914ae/31.png 860w,/static/4776f353d541b3599761a6bb1487bcf8/b0aa6/31.png 1233w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Check your running instance, &lt;code&gt;Add to registered&lt;/code&gt; and check the added instance on upper panel. Then click &lt;code&gt;Next: Review&lt;/code&gt; and &lt;code&gt;Create&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:63.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB9ElEQVQ4y61U23LTMBD1v8MHwT/wysAAndSxk7iJI1tX25LviX1YqU1pOzDwgGbO7O7RWlrpaB0ZN0DbHk07oh9nKO/3M+xwwXxdYftL8B3hQvHj3BXzPMKaEs5wTNOIdrzCjyhNU3gkSYLtdos4juGcRds6sg5d14bYWs+1FHeBbwOIc03wfZ61DaIsy5DnOYQQ0MbAEMZxpApm2nl6ti/h53/5r/mwoAfnPOzu0TTNK/iKarJ+8b+NiLHzc7AsV6zrQnbBesP6BPKB9Slz/cNyK6KHY454m+DMSkhtUHKJ3f4ALiQUxfmZ0VwBVpTYHzJIZSCkojyBOElxHyeUUxCvAx8xM6B2PVTlkJcaxo7QjVd+gHETSm0hTIfS1tgzhlI5VO0EVfc4nDiynD/m0ncekVfvf45ol8TgBYMUHEVRBDCqxItU1zWqqgr2rVCeu/G3HG+j9x/3ePdhh08bgd7VsK7FMAz/pOhvK/wSn/B5c8SB7qLvHJRS9BbpLrWGlBJaK2jipBR0CgFFnHrJ+/dL9hZHXt1sn6KgY57OJTZxipwJZKccPzb3xHEc8wLf7+7x9dsd0v1DyPHcifHAbbzS5HtE0k5Y6FmN8wW17+d5RTdSz9Kr57WBJjUd9a7QTYD3uWpI0Z76dwk+4xoV/RO6acFPMGTgs9LwUo8AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;32&quot; title=&quot;32&quot; src=&quot;/static/0ae3f894c310b0c97430a8dfb17366c9/914ae/32.png&quot; srcSet=&quot;/static/0ae3f894c310b0c97430a8dfb17366c9/2eb24/32.png 215w,/static/0ae3f894c310b0c97430a8dfb17366c9/05ed2/32.png 430w,/static/0ae3f894c310b0c97430a8dfb17366c9/914ae/32.png 860w,/static/0ae3f894c310b0c97430a8dfb17366c9/eb390/32.png 935w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Select the created balancer and click &lt;code&gt;Listeners&lt;/code&gt; tab on the lower panel. Select listener for HTTP: 80 then click &lt;code&gt;Edit&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:811px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:42.7906976744186%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABdUlEQVQoz32SW2vCQBCF8+v7E0RaYy6b+81oor6lRmp8EESw4FNNlVqxgohQ9e00s6BI2hr4mOwmnJ1zZgVN06BqBjSmwjR0RFGEdruNOI55vUBrotVq8X/+Q5BkBZ7rwGR1+I4OyzKhqipc1+VVURReLcuCruu/DiojKOIjdCZDVlTUJRmiKKJaraJWq0GSJA6JcieFsG3bXNw0TV5voW+CHGUw4xcMez0MnxMMBgOMx2Okaco7ajQa3Gaz2eSEYXgX4aG7wVP6hfVbju/1CqvVJ+g5HA48k06nc7VJ78RtpmWE+XyO1+kUH8slvjYbbLdbvOc577BSqYAxxjulKGhNcVz2KIYywm63w2KxwH6/x+l0wvl8xvF4RF6IUiYXK5SZbTtwimH5vo8gCP5EoLySJEG/38doNMJkMsFsNkOWZXAcB57ncQGaeuB76HYL2/csG4bBJ0mWaJrUFQnR1EiICIvB6JYLkdlgVgDNDq73sXwvfwDzvy9VMC01bwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;33&quot; title=&quot;33&quot; src=&quot;/static/0c6691674f2f5d95d8592ad07a526c28/fd28b/33.png&quot; srcSet=&quot;/static/0c6691674f2f5d95d8592ad07a526c28/2eb24/33.png 215w,/static/0c6691674f2f5d95d8592ad07a526c28/05ed2/33.png 430w,/static/0c6691674f2f5d95d8592ad07a526c28/fd28b/33.png 811w&quot; sizes=&quot;(max-width: 811px) 100vw, 811px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Remove the default action
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:556px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:84.18604651162791%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAAAsTAAALEwEAmpwYAAABzUlEQVQ4y42Ut44CQRBE+X8CSBDeCA+7eCMQCQkB5h8gJCAhJOrTa1SrOU6nu6DUZnpq282mFouFDQYD6/V6NhwOLY5j6/f7lsvlrFQqWT6ft263a5vNxlar1Z9ILZdLG41GFkWRk4kU4AOcYyPH47HLyWTyTUcCJ6zX655JtVq1QqFglUrFUSwW3Qc4J2P5uYMfXT7uOqG+MJ1Of4AzYTabJb4whkw5w5+ibtjpkw6F8CJ2WLY+EsY5IUOhbwyi0+k4cbPZtHa77bZ82K1WK9FlA3T8xHrJOsQBsSbGWYhwmqEvjEkIG41G8mVNm3XS9D8nzrk2QjHACVHYQ3R6Qj/IlJ7QEvzI/8B7GJYhOZ/PHSL8DZ9t8AxrtZqVy2XfK3aNssKsRPwJrYq2gjgnpFdMCUmpSPVIunoomzjunk4nOx6PdrlcbLvdvveQCbP5ZMkbRtJTLgnYAjZ39vu9vV4vu91u9nw+7Xw+vzPUDmYyGUun0/7MstmsPyXtJERUAdAh3O12dr/f7Xq92uPxsMPh8CakBILoIdnpbQLskFBZopOIfgr0b71ef18blRfuVbiDnwj7TFwyZQ7JgvKAAsLLcRQnMtGDDzJluL4AVwsB3XxW4N4AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;34&quot; title=&quot;34&quot; src=&quot;/static/3283f4ca2d2f1fe67fbebeb704ba953b/96638/34.png&quot; srcSet=&quot;/static/3283f4ca2d2f1fe67fbebeb704ba953b/2eb24/34.png 215w,/static/3283f4ca2d2f1fe67fbebeb704ba953b/05ed2/34.png 430w,/static/3283f4ca2d2f1fe67fbebeb704ba953b/96638/34.png 556w&quot; sizes=&quot;(max-width: 556px) 100vw, 556px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Then create the following action and click &lt;code&gt;Update&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:586px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:103.72093023255813%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAYAAABG1c6oAAAACXBIWXMAAAsTAAALEwEAmpwYAAACHklEQVQ4y52U2a6jMAyGef+X612l7i0M+9YC3RcfPhcjynQu5kT6ZcdJHPu3E+d+v0uWZbLf76WqKjmfzzKfz2Uymchms5Hlcin/M5zn8yllWapDQ13Xcjgcet3mx+NRmqbpQQDYkMzRndvtppGsVivZ7XYym83E8zxZr9cK13VlsVhopNvtVm2sY+cMZ7HZHufxeOjtpP56vYSIgemsg29rQ7AH6VwuF+UMp6RG+OiWjqUGLUaDrQ/3obNHI8SY57kWpyiKnlM22SFs5sTWkWZnzlnlEO6iKFJuTqeTVmuYrmFsG84tda1ymqYaHSlbZNxGKlwA0GkpdKuo2ZG25hANE8DgNlv8zVAOranhkRt/M6g8+ODQ930Jw1Cu16tQfUC0zIc2AzbOA5xphChwiFMcohMpHCJNH8+RVJhCIi1KLUoQBDKdTrXT0a0FrIXM0RCssY+XguwdGodxHGsKViQqjo3iQAMHeW6AJ5gkSR+lFbR3iJF0cWCAU+NvzJ1xiySYvxwSPlHEcdI5fEuitJb6F+jZD4fv76vlo8wliSMJ/D9tdGHLZaitRAUvXZXHYO2Lw4e4YS4LL5VtkMvcyyRMC6m6N/u+rOyL9A32CPqUkzSTIEoljFOVzPWjaEn32/nCjVXPvlSbNvtwSMpw1YDmLUkV1HUlWbEXPyml7mxjkDLF+XDILbQDrUG1q6ruvy4cNXX393W28bc25PAHTJNNG2ARnAcAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;35&quot; title=&quot;35&quot; src=&quot;/static/c6ae116627b00ed850e1cf5e9e8a63bd/a76f4/35.png&quot; srcSet=&quot;/static/c6ae116627b00ed850e1cf5e9e8a63bd/2eb24/35.png 215w,/static/c6ae116627b00ed850e1cf5e9e8a63bd/05ed2/35.png 430w,/static/c6ae116627b00ed850e1cf5e9e8a63bd/a76f4/35.png 586w&quot; sizes=&quot;(max-width: 586px) 100vw, 586px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;todo-missing-adding-two-aalias-records-to-route53&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#todo-missing-adding-two-aalias-records-to-route53&quot; aria-label=&quot;todo missing adding two aalias records to route53 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;TODO: Missing adding two A(Alias) records to Route53&lt;/h2&gt;&lt;h3 id=&quot;modify-nginx-config--install-certbot&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#modify-nginx-config--install-certbot&quot; aria-label=&quot;modify nginx config  install certbot permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Modify nginx config &amp;amp; Install certbot&lt;/h3&gt;&lt;p&gt;Change content of nginx config&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;OR&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;nano&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Change the &lt;code&gt;server_name&lt;/code&gt; to your domain names for rerouting&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;nginx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-nginx&quot;&gt;NGINX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-nginx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;# Reroute to HTTPS&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80 default_server;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen [::]:80 default_server;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name &amp;lt;yourDomain.com&amp;gt; &amp;lt;www.yourDomain.com&amp;gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return 301 https://$server_name$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  client_max_body_size 10m; # Increase upload size limit&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location / {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # Connect node api&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_pass http://127.0.0.1:8080;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_http_version 1.1;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Upgrade $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Connection &amp;#x27;upgrade&amp;#x27;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Host $host;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_cache_bypass $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_redirect off;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Install certbot&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~ &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; add-apt-repository ppa:certbot/certbot &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Then press enter&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; update &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; python-certbot-nginx &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Then press Y&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Run certbot after installation&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; certbot --nginx -d yourDomain.com -d www.yourDomain.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It&amp;#x27;ll prompt you with..&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Enter your email&lt;/li&gt;&lt;li&gt;Press &amp;quot;A&amp;quot; to agree&lt;/li&gt;&lt;li&gt;Y/N whether to share your email&lt;/li&gt;&lt;li&gt;Press 2 to redirect traffic&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Certbot will automatically insert codes inside nginx configuration file:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;nginx{10-16,&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-nginx{10-16,&quot;&gt;NGINX{10-16,&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-nginx{10-16,&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;# Reroute to HTTPS&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80 default_server;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen [::]:80 default_server;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return 301 https://$server_name$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 443 ssl; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ssl_certificate /etc/letsencrypt/live/yourDomain.com/fullchain.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ssl_certificate_key /etc/letsencrypt/live/yourDomain.com/privkey.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  client_max_body_size 10m; # Increase upload size limit&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  # Check if maintenance is on&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location / {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # Connect node api&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_pass http://127.0.0.1:8080;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_http_version 1.1;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Upgrade $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Connection &amp;#x27;upgrade&amp;#x27;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Host $host;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_cache_bypass $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_redirect off;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = www.yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80 ;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return 404; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;this-is-it-save-default-and-run-sudo-systemctl-restart-nginx-to-apply-change&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#this-is-it-save-default-and-run-sudo-systemctl-restart-nginx-to-apply-change&quot; aria-label=&quot;this is it save default and run sudo systemctl restart nginx to apply change permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;This is it! Save &lt;code&gt;default&lt;/code&gt; and run &lt;code&gt;sudo systemctl restart nginx&lt;/code&gt; to apply change&lt;/h3&gt;&lt;h2 id=&quot;create-a-scheduler-to-automatically-renew-your-certificate&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-a-scheduler-to-automatically-renew-your-certificate&quot; aria-label=&quot;create a scheduler to automatically renew your certificate permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create a scheduler to automatically renew your certificate&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; select-editor &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Choose your favorite editor&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;crontab&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -e&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Insert this &amp;amp; save&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token number&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;23&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; * * * /usr/bin/certbot renew --quiet&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Your Ubuntu machine will run &lt;code&gt;/usr/bin/certbot renew --quiet&lt;/code&gt; every day at 11:11PM for auto renewal of SSL certificate&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;enable-maintenance-mode-for-your-app&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#enable-maintenance-mode-for-your-app&quot; aria-label=&quot;enable maintenance mode for your app permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Enable maintenance mode for your app&lt;/h2&gt;&lt;h3 id=&quot;maintenancehtml-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#maintenancehtml-example&quot; aria-label=&quot;maintenancehtml example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;maintenance.html example&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:466px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:45.58139534883721%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABX0lEQVQoz22S204CQQyGeQpdYBeYFjHKQZAYo8hpBSQERQHBACqJibcmXvvuv+3OLlmJF/+2nbbfdHYmQUQwxoDF5tmKVRTaff8/hQxlJSIn7RocOAaHSQNH5HoGyZRBKm2CnPpOKF1Tq2tJ8V3XMpSVULqXMZgMCT9fjO9PxnrGuG0R3heM8YAw6hHm94yNrL89c1C7nDBmY8LTiILaTDacUD8a9NqE9ZTx8sjYLhlDXyBhg/qvAtrKBqspYfFA+FjJBnON7aY61A6YyxmUTgmVEqF2RqhXKYjLRetHcbVi89WyzdUqtqd4Yhk7YFaCeo3Quib4Mv6dTNS4tLFON/QZ3Rub05P4TUJbcoOu1FwRLs6Fkd27FD22ju159kd3pWncZ3QahH7HggYdC28KJOXaWu2J/l9wKRS78rj0ORwXCIUjUczqWj4f1sTqd89mHxQl1OZEcRv3oxpj/vb/AmZADKfOxDXoAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;maintenance&quot; title=&quot;maintenance&quot; src=&quot;/static/9a5d46b285f81ee3df6307372a1eb85e/fc1a1/maintenance.png&quot; srcSet=&quot;/static/9a5d46b285f81ee3df6307372a1eb85e/2eb24/maintenance.png 215w,/static/9a5d46b285f81ee3df6307372a1eb85e/05ed2/maintenance.png 430w,/static/9a5d46b285f81ee3df6307372a1eb85e/fc1a1/maintenance.png 466w&quot; sizes=&quot;(max-width: 466px) 100vw, 466px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;en&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;UTF-8&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;viewport&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;width=device-width, initial-scale=1.0&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;http-equiv&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;X-UA-Compatible&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;ie=edge&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Ramen Kid | Maintenance&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css selector&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css hexcode color&quot;&gt;#222&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css selector class&quot;&gt;.main-container-maintenance&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; Arial&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; Helvetica&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; sans-serif&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css hexcode color&quot;&gt;#fada26&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css function&quot;&gt;translate&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;-50&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;-40&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;main-container-maintenance&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Offline for maintenance&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        This website is undergoing maintenance right now (·_·)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Please check back later!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;turning-onoff&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#turning-onoff&quot; aria-label=&quot;turning onoff permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Turning On/Off&lt;/h3&gt;&lt;p&gt;When the file exists, your app will only serve &lt;code&gt;maintenance.html&lt;/code&gt;. Make sure to put it under directory, &lt;code&gt;/opt/maintenance.html&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;To turn it on or off&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Turn ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; maintenance-.html maintenance.html&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Turn OFF&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; maintenance.html maintenance-.html&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;nginx-config&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#nginx-config&quot; aria-label=&quot;nginx config permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;nginx config&lt;/h3&gt;&lt;p&gt;Modify nginx config to detect whether there exists &lt;code&gt;/opt/maintenance.html&lt;/code&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;nginx{21-23,&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-nginx{21-23,&quot;&gt;NGINX{21-23,&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-nginx{21-23,&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;# Reroute to HTTPS&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80 default_server;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen [::]:80 default_server;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return 301 https://$server_name$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 443 ssl; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ssl_certificate /etc/letsencrypt/live/yourDomain.com/fullchain.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ssl_certificate_key /etc/letsencrypt/live/yourDomain.com/privkey.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  # Increase upload size limit&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  client_max_body_size 10m;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  # Check if maintenance is on&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location / {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if (-f /opt/maintenance.html) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      return 503;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # Connect node api&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_pass http://127.0.0.1:8080;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_http_version 1.1;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Upgrade $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Connection &amp;#x27;upgrade&amp;#x27;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Host $host;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_cache_bypass $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_redirect off;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  # When /opt/maintenance.html is found&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  error_page 503 @maintenance;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location @maintenance {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    root /opt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    rewrite ^(.*)$ /maintenance.html break;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = www.yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80 ;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    return 404; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;more-notes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-notes&quot; aria-label=&quot;more notes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More Notes&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;To check remaining space in storage of EC2 instance, run &lt;code&gt;df -h&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[React + Node.js]: Deploy Your MERN Stack App to Amazon EC2 with SSL Encryption]]></title><description><![CDATA[Heroku vs Amazon Web Services (AWS) Both are popular choices for cloud services where you can deploy your web applications and are great for…]]></description><link>https://ellismin.com/2020/03/deploy-mern-2/</link><guid isPermaLink="false">https://ellismin.com/2020/03/deploy-mern-2/</guid><pubDate>Wed, 18 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;heroku-vs-amazon-web-services-aws&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#heroku-vs-amazon-web-services-aws&quot; aria-label=&quot;heroku vs amazon web services aws permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Heroku vs Amazon Web Services (AWS)&lt;/h2&gt;&lt;p&gt;Both are popular choices for cloud services where you can deploy your web applications and are great for hosting them. Heroku, in my opinion, is a lot simpler when it comes to deploy MERN stack application, but I still wanted to cover them both.&lt;/p&gt;&lt;h2 id=&quot;prerequisites&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#prerequisites&quot; aria-label=&quot;prerequisites permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Prerequisites&lt;/h2&gt;&lt;p&gt;If you don&amp;#x27;t have MERN Stack project available, here is how you can set up a basic MERN stack application with REST API.&lt;/p&gt;&lt;h3 id=&quot;--react--nodejs-create-your-mern-stack-application---part-1-backend&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#--react--nodejs-create-your-mern-stack-application---part-1-backend&quot; aria-label=&quot;  react  nodejs create your mern stack application   part 1 backend permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;- &lt;a href=&quot;/2020/03/mern-1&quot;&gt;[React + Node.js]: Create your MERN Stack Application - Part 1: Backend&lt;/a&gt;&lt;/h3&gt;&lt;h3 id=&quot;--react--nodejs-create-your-mern-stack-application---part-2-frontend&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#--react--nodejs-create-your-mern-stack-application---part-2-frontend&quot; aria-label=&quot;  react  nodejs create your mern stack application   part 2 frontend permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;- &lt;a href=&quot;/2020/03/mern-2&quot;&gt;[React + Node.js]: Create your MERN Stack Application - Part 2: Frontend&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;In addition, be sure to go through some steps from the &lt;a href=&quot;/2020/03/deploy-mern-1&quot;&gt;last post&lt;/a&gt; on how to..&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;/2020/03/deploy-mern-1/#serve-indexhtml&quot;&gt;Serve the static index.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;/2020/03/deploy-mern-1/#create-production-build&quot;&gt;Build your client&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;/2020/03/deploy-mern-1/#whitelist-ip-on-mongodb&quot;&gt;Add whitelist IP on MongoDB&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;You can choose skip above steps and &lt;a href=&quot;https://github.com/EllisMin/mern-demo-production&quot;&gt;download the project&lt;/a&gt;. I&amp;#x27;ll be using this project to deploy on AWS EC2.&lt;/p&gt;&lt;h2 id=&quot;1-create-ubuntu-aws-ec2-instance&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-create-ubuntu-aws-ec2-instance&quot; aria-label=&quot;1 create ubuntu aws ec2 instance permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Create Ubuntu AWS EC2 Instance&lt;/h2&gt;&lt;p&gt;Go to &lt;a href=&quot;https://aws.amazon.com/&quot;&gt;AWS console&lt;/a&gt; to sign up with your account if you haven&amp;#x27;t. Once singed in, &lt;code&gt;Launch a virtual machine&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:55.348837209302324%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB2UlEQVQoz3VS207bQBDN//8BJL6sb2t7ba+vwU8ECaSGz2jFLdBStU2lUCCHmY1t4KGWxnuZ2TPnzMxMxjGOjueYLxbGFpZFqwXLtuG4Lq2OueO4VCkkafpfY/9Mxglseih8H64QOJ4vYDsOhOeZM/v4HCeJecCmsmyyMcnom/FPSokgCFAUBeq6RlmVKMvPprVGlueIogie58OneJ9IKJWiIn9OPgaecRZ2sjy+ZFAGYOCP1jSNuXcFMWfWVBLLsuGFEXxJoFV1YMiAOYEYMGLBgFoTo4HZR1BmGcnYxGeDXJXlSLPD20myUhliquUBTE/SmVXNNuzZFxIjQbVlAlVdmTuti3fJnG11dobT1Qrn5xdYX17iy3pNwbUpOgeOxjUMwxCu45o6MviYnM0Adl2H25sbXF9d436zwW63w5/tFn3fQxf51JCRuUwURBQfRoU6z0mNgrYZAJdL3D3+xuPfJzxsn7Dd/cPL8zPKrocdUL2oni3JHZvC4+MHoZmMkRk3ZGrK8uQEm4fv+PHzF172wOuefvQ17RJBJGmEKrSUvW1bs2fJguRaXohAEkPTA/XeFJb29dsVbu82Bmg/ACapolES6CkhsxsBmSHPYkPnlsrVDcYxLPkNg8OmzluEUCIAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/12aa9c9462c3d68a03b5acdc11012dbb/914ae/1.png&quot; srcSet=&quot;/static/12aa9c9462c3d68a03b5acdc11012dbb/2eb24/1.png 215w,/static/12aa9c9462c3d68a03b5acdc11012dbb/05ed2/1.png 430w,/static/12aa9c9462c3d68a03b5acdc11012dbb/914ae/1.png 860w,/static/12aa9c9462c3d68a03b5acdc11012dbb/7bf07/1.png 1128w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Search for &lt;code&gt;ubuntu&lt;/code&gt; and select &lt;code&gt;Ubuntu Server 18.04 LTS (HVM), SSD Volume Type&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:36.74418604651163%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAABcElEQVQoz1WSy07CQBSG+8q+hS/gBgoUepsC7bSFLpAF6t6NNyQEKLQFaoGIURuIye/MQBAn+fLPycm5TP6RdE2FplahqipqtZpQRVH+qW3bgkajIdRxHIHrugyKpk2hEpZnKpmmCV3XBZqmwTCMQ8xUZTEhFigrdCgFPcIb0bOY52zncJcodcQlCAK0fF8Ue56Hdss/0fI9gee5x63+4M1810GnTeGxbaU6MVCtVlGvW+jd3GKznCOKYjwMQjwJJngeThkzhLMYSRyzfISYKWedveG+H4L0+nh8HUPiTywWiygUCrjudhEOBwjDKUZRitFsiWGYYJFtkW2/8fmVY7fbIc9zwX6/Bz/J+w/uXjKsP3JIhBCUy2XIsoxOp4M0XbLJEabhBHE0w2Q8wpzFnDRNka1WyLLsxGazwRvTZJGyugSSZVnCSb6pVW9Aq5RQUyooyiUxRC6VhNvcMF03cG6iaRIEbR9XShMXl+xHEAe/XwLDiUBPdj0AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/8b9d76a050ec4fc0b3966dba76e821e8/914ae/2.png&quot; srcSet=&quot;/static/8b9d76a050ec4fc0b3966dba76e821e8/2eb24/2.png 215w,/static/8b9d76a050ec4fc0b3966dba76e821e8/05ed2/2.png 430w,/static/8b9d76a050ec4fc0b3966dba76e821e8/914ae/2.png 860w,/static/8b9d76a050ec4fc0b3966dba76e821e8/91608/2.png 1251w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Make sure that &lt;code&gt;t2.micro&lt;/code&gt; (Free tier eligible) is checked and click &lt;code&gt;6. Configure Security Group&lt;/code&gt;.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:43.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB00lEQVQoz4VSy67TMBDNr/UL2FQCQSVaWqRcqZ9R9V/YsmaLEI/2LuCqIGiapGmapx3n5Tx7GBvdu2WkozkzssczZ2ykogRLQoS+C57GiHkBXkjUbQ9Rt6iaXqOUHVjZ6HzVdBjGEcput5vGoxmnkwXHtuA6J9inIxzHQRyFYGkCzhKkSYQkiZGmiieaJylHzDLiCeI41lC8bVsYQRji4vsoihJSNnQx1Sipu7RoqdsGwzBipI76fiD06CnWUJwwDMOTN1T1KIr0C1n271VVUOQFsqJCXtYoqwpN0+B/pkY3gusVPnWoCit/pdjzPMIZruuQDJb2lnWEbdsIggCHw4EkchCGgZbI9y84n9V5F0ZKWjjuGQnjELSgPK8gSXSFWrYoqMOm60k3hkzklG+1hpx4Jgq43gXe5QqeCX3GuDKJ306AWHTYWT/x7sN77B+O2P/4gx1B+XuKP379jk+7B/yyAxQdkEmAVSPcgMMNM/oBAyJBS5FSag3V/F++fcaLVy+xXK2wXC6xWCw05vM5VpSbTqfYbrdar67r9CKEEDRVrrnS2ajrWuum/tX9fo/Xz5/BfPsG5t0d1us1TNPUmM1mmEwm2Gw2uuDjVhlj4Jw/FfwLzqCNWdPCjk4AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/914ae/3.png&quot; srcSet=&quot;/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/2eb24/3.png 215w,/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/05ed2/3.png 430w,/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/914ae/3.png 860w,/static/d95ac9f9be978c7e8d6ea3c2cbf9a6fc/b5dee/3.png 1237w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Add more types: &lt;code&gt;HTTP&lt;/code&gt; and &lt;code&gt;HTTPS&lt;/code&gt; by clicking &lt;code&gt;Add Rule&lt;/code&gt;. Once added, click &lt;code&gt;Review and Launch&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:38.604651162790695%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABIElEQVQoz32Q2ZKDIBBF+f9fnERTqaRcWBRZVNDcdDOjL5MZilNNN71wEdZHjC5AjR4uzNA2IC4Znogrs2FdItwo4a3CMkfMaQfwwqclrlWFy+WrUFVX1ITRGuMwwBgNpRS0VhQjqyShzviB1t9+CAFiigmSnK7r0PUSTU/NRm5mEOcZ27YhE8Xmw+aP8J3gZy7LUqY472GGEY/HozT05O/7Xni9Pkv8JXmaplJ4v99R1zUGavR8Psu5bdvy8tvtViQ553DkM1LKU+oRExwMdLDWYiJijOVioD/kRPabpimNOde5qTRm2G/bBn3fF0XsC0OFh2z+I15sU0qnDHl+vMa6piKf4YFcr7VBoMH8CGEHDeyZ9vonW15+7Ppv3p4T3tUUaGHhtG/rAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/b826d31930244cea9862c7ad11c36cdf/914ae/4.png&quot; srcSet=&quot;/static/b826d31930244cea9862c7ad11c36cdf/2eb24/4.png 215w,/static/b826d31930244cea9862c7ad11c36cdf/05ed2/4.png 430w,/static/b826d31930244cea9862c7ad11c36cdf/914ae/4.png 860w,/static/b826d31930244cea9862c7ad11c36cdf/5a791/4.png 1248w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Click &lt;code&gt;Launch&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:60.930232558139544%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAABs0lEQVQoz52S2ZLcIAxF+f8PSyqzJJXXVLrG3d4Ndhsv0MbLDZcZEiePcdWxJGQukrCoqxyyqTzlBxV038KaCfM0wMxjYJ60t4NfH4ONcP1hR+BYcewrxDG9YSi/o02/or29oPOWyOQpoK4vkB7m1fUZbfYNXfMj0NLKC8xUYF8qwEkIZzvMY4PHJGE9i2k9KvCYVYhpz8Q1fm/mO4zpfZU93GOAUFWFLHlDrwfc7z3atoXydN0dfa993EFKBWMt1nWDc2tgcQ77fiA+bt1hlx3iy+dPeH1+wjzP0Lr3Qi2maYL1AmfWdfU4bNvmhfYQH8cfwegJpRR+Xi6g7bruN1LKUC39uq7RNI2vuA+28l0xz46apkaaF7hcC6hOQ/CjPM998h4sRQg3UqwsS2RZFg7UWgch5hgPwxD2JEkS9rBLwRcTy7Lgf59lA7TdYJ2fIatI0zTMieJsj5WM4xhmGQ/jvDi7aP/l+MgJthpFCFvkjGJcFEWAoyG32y20TZ97OY44XxYRWmZ18SRWxRuMsTHmr0ooworpxxs/+4KqhAsUos8N77/Je+z8PxdjVn3On6HGLxqImI+jgowZAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/db07a606236a468a76f42def99bad920/914ae/5.png&quot; srcSet=&quot;/static/db07a606236a468a76f42def99bad920/2eb24/5.png 215w,/static/db07a606236a468a76f42def99bad920/05ed2/5.png 430w,/static/db07a606236a468a76f42def99bad920/914ae/5.png 860w,/static/db07a606236a468a76f42def99bad920/0f529/5.png 1259w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Create a new key pair. Name your key (filename), &lt;code&gt;Download Key Pair&lt;/code&gt; then click &lt;code&gt;Launch Instances&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:687px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:71.16279069767442%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAACQklEQVQ4y52T647aMBCF89StVKkP1Fb900do1WpLEQhY7pAsgc09ISTBSeyE0xkH2G37r5Y+zngGH49txVitVuj1ephOpxiPxzoeDoeYTCbo9/vg+mg0wmAwwHw213muM7ZtI01THI9H+L6Pw+EAI89zxHGMJEnuysUwDPX8lmM4xwRBoPNsxIZRFCHLMlRVBYMLi8UCpmlqNpsN5vM51uu1znOHy+VS12azme6QlXMM/4/nlmWhbVsY7Mytuq4Lx3F0dxyn6QlCCJzPZ/ApOC7LUs+Zoij+QUoJgwNuuTtehIT1eoSiyFFqI/GHyc2UuW1a1zV4GEkS4+D42Acn7LwjTCfR+kRqPYd4ckmdGOkp053yRqy3mDfgmLvXhvzjeR422y2spx3s/QFxckRVS7rkGqKsUJJyB3wkhmMlCSU7JYQ443K5dIa2vacLXukH4Z2UUvfFd5PX0GaFkMjFi4pKkRMZkinaRqJRFe0kdbIbN/17XMBrBlMb3x5G+PFriu+9CRZW+HLkXVxh7ZdIyxbRWSEsOoJcwsskXMKnmOe+RsH0C2zcE9bOCdP9EU7y6g6/LlN8GUaYk+lgf0Z/V2BI+tPK8WDmWh8dgUdXYEw6ehZYBBVmXoWJU2IR1ohEA27daNsL0rrFc6ZocUZm+R0zrmElHVzfnyShYKdS41KnHpFULYRqO0N+mbJWGtk0RHvVK6qjkg1q1isFPcLaF1gRC+p8Q9rwl4L/GFHeYBOUePNhi7cft3j3ycT7zxayUuE30dghcLl2tysAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/e45243618db0ce24e5e3ec5257f51122/aec65/6.png&quot; srcSet=&quot;/static/e45243618db0ce24e5e3ec5257f51122/2eb24/6.png 215w,/static/e45243618db0ce24e5e3ec5257f51122/05ed2/6.png 430w,/static/e45243618db0ce24e5e3ec5257f51122/aec65/6.png 687w&quot; sizes=&quot;(max-width: 687px) 100vw, 687px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Click &lt;code&gt;View Instances&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:52.093023255813954%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAABeUlEQVQoz42S627cIBCF/f4P19+V0nbjJLWNMQZzNwZOB9KtNmojFenTnLHRMLfBWAupJJx3qABKrZ1cC3LJnUK6PPifUzCItGN2C25qxKhecJMjXo836Kjhi4dJFiJoyGhgs/03V8NAEwN3ES/S4PuqcNsUfqwSz1yCGwdB/zYXMB8Oi/EQPnS/86CFj9jD2RlWnfC8RTyxgG+zxo0ZTDKA64hFOqxH+ABrKP+uyTa4OUFhcMSKQcodK1uw8RV8ZVBSwBoq13ucZ+w2xkDEbs/z7PpsdB06ge5d10UBd+rhNFGwFWLjYIx1FD2kD9WtEAJKqT9WStlRmgZ6mP5tJ9/SgIfDBrxR/34Sr0xCG4s2+XHasOwONpY+/f89g6WmSu06+2ERQsCVM0IqcDETV1+HWhv1U3KhdSPeM+QakzBYaMoz41ipfLkLtP562s9WSqM91s49yF1/yLBlIkyCchdSrpRdRUrpN9dfJT0GuGtDlXwZLb7OHr8A54UFaiNwdgQAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;7&quot; title=&quot;7&quot; src=&quot;/static/e32cb01c393fdf6f0c175078569002dc/914ae/7.png&quot; srcSet=&quot;/static/e32cb01c393fdf6f0c175078569002dc/2eb24/7.png 215w,/static/e32cb01c393fdf6f0c175078569002dc/05ed2/7.png 430w,/static/e32cb01c393fdf6f0c175078569002dc/914ae/7.png 860w,/static/e32cb01c393fdf6f0c175078569002dc/11a8f/7.png 1272w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Under &lt;code&gt;Description&lt;/code&gt; tab, copy your &lt;code&gt;Public DNS (IPv4)&lt;/code&gt; as you&amp;#x27;ll need it soon&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:14.883720930232558%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAlklEQVQI12WO0QqEIBBF+/+viE2lddXF1AXxVaOH6B8iqP7ibiP01MPhXoaZO7d5ixeIj5TgnENeKoSokDfGwHsP59yDYRges+ZrFAitNbquq0GkbduCMVYD72VrLVJKWNcV27bhPE8cx4F93yvkGx8CQvhd3xz6vodSqkLHFELtbqhRjBHLsmCaJszzjFIKcs6VcRzxB/oevQJ96tgzAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;8&quot; title=&quot;8&quot; src=&quot;/static/d510dde8385c4e3d23d53061147ad983/914ae/8.png&quot; srcSet=&quot;/static/d510dde8385c4e3d23d53061147ad983/2eb24/8.png 215w,/static/d510dde8385c4e3d23d53061147ad983/05ed2/8.png 430w,/static/d510dde8385c4e3d23d53061147ad983/914ae/8.png 860w,/static/d510dde8385c4e3d23d53061147ad983/65d79/8.png 905w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;2-connect-to-your-instance&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-connect-to-your-instance&quot; aria-label=&quot;2 connect to your instance permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Connect to your Instance&lt;/h2&gt;&lt;p&gt;Open your git bash(windows) or terminal(mac) then browse over to the directory you saved your key file. Then run the command to change file access (User can read only).&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/Downloads/aws-key-1022.pem&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then connect to your instance with your copied &lt;code&gt;Public DNS (IPv4)&lt;/code&gt;. i.e. &lt;code&gt;ssh -i ~/Downloads/aws-key-1022.pem ubuntu@ec1-4-56-119-211.us-east-2.compute.amazonaws.com&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -i ~/Downloads/aws-key-1022.pem ubuntu@&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;YOUR_COPIED_PUBLIC_DNS&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;3-install-required-packages-on-ubuntu&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-install-required-packages-on-ubuntu&quot; aria-label=&quot;3 install required packages on ubuntu permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Install required packages on Ubuntu&lt;/h2&gt;&lt;p&gt;Run the below command to install all packages needed to run the server on Ubuntu.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; https://ellismin.com/sh/linux-mern-setup &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What&amp;#x27;s inside: &lt;a href=&quot;/sh/linux-mern-setup&quot; target=&quot;_blank&quot;&gt;linux-mern-setup&lt;/a&gt;&lt;br/&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Add nodejs 10 personal package from nodesource&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -sL https://deb.nodesource.com/setup_10.x &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -E &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;bash&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Install Node.js &amp;amp; npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -y nodejs&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Import GPK key for MongoDB&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4B7C549A058F8B6B&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Add MongoDB APT repository at /etc/apt/sources.list.d/mongodb.list&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;tee&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/apt/sources.list.d/mongodb.list&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Instal MongoDB on Ubuntu&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; update&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -y mongodb-org&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Start MongoDB&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl start mongod&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Start MongoDB automatically on startup&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;enable&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongod&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Install pm2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -g pm2&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Start pm2 automatically on startup&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 startup systemd&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Install nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -y nginx&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Enable UWF--allow SSH with firewall&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ufw allow OpenSSH&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Allow HTTP/HTTPS with firewall&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ufw allow &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Nginx Full&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Enable firewall&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ufw --force &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;enable&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;4-set-up-your-mern-application-with-nginx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-set-up-your-mern-application-with-nginx&quot; aria-label=&quot;4 set up your mern application with nginx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Set up your MERN application with nginx&lt;/h2&gt;&lt;p&gt;Clone your repository into your Ubuntu machine. Note that I&amp;#x27;m using a project that was set up in &lt;a href=&quot;/2020/03/deploy-mern-1#serve-indexhtml&quot;&gt;this post&lt;/a&gt;. Client folder(front-end) is located inside the root directory that contains other the back-end code.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; clone https://github.com/EllisMin/mern-demo-production.git /opt/mern-demo&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Tired of github authentication for pulling repository? Create ssh-keygen with &lt;code&gt;cd ~/.ssh &amp;amp;&amp;amp; ssh-keygen&lt;/code&gt; then keep pressing enter for prompts. Run &lt;code&gt;cat id_rsa.pub&lt;/code&gt; to copy the key &amp;amp; paste into github repository --&amp;gt; &lt;code&gt;Settings&lt;/code&gt; --&amp;gt; &lt;code&gt;Deploy keys&lt;/code&gt; --&amp;gt; &lt;code&gt;Add deploy key&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Use &lt;code&gt;cd ~/ &amp;amp;&amp;amp; git clone &amp;lt;Repo&amp;#x27;s SSH&amp;gt;&lt;/code&gt; to clone your project inside &lt;code&gt;root&lt;/code&gt; folder. Don&amp;#x27;t include &lt;code&gt;sudo&lt;/code&gt; keyword, and make sure to use &lt;code&gt;SSH&lt;/code&gt; key (i.e. &lt;a href=&quot;mailto:git@github.com&quot;&gt;git@github.com&lt;/a&gt;:EllisMin/repo-name.git), not &lt;code&gt;HTTPS&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Navigate into project folder and install npm packages&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mern-demo &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;If npm installation fails, you may have to set a flag. &lt;code&gt;sudo npm i --unsafe-perm&lt;/code&gt;. &lt;a href=&quot;https://docs.npmjs.com/misc/config#unsafe-perm&quot;&gt;Read more&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;Start the server with &lt;code&gt;pm2&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 start app.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Why use pm2? While running the server with &lt;code&gt;npm start&lt;/code&gt; works, the server may crash if there&amp;#x27;s an error or unexpected behavior occur to the server. pm2 allows to keep application alive forever by reloading Node.js application without downtime.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;Tip: more commands for pm2&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# You can use [filename] instead of all&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 stop all    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Stops all process running with pm2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 restart all &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Restart all process running&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 delete all  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Remove all process from pm2 list&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 logs        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Displays log messages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 status      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Shows status of running servers&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;configuring-nginx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#configuring-nginx&quot; aria-label=&quot;configuring nginx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configuring nginx&lt;/h3&gt;&lt;p&gt;Start off by removing the default setting for nginx&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, create a new default for configuration&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;nano&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;/etc/nginx/sites-available/default&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;nginx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-nginx&quot;&gt;NGINX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-nginx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name _;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  # Use below this if you need custom domain&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  # server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location / {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # Connect node api&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_pass http://127.0.0.1:8080; # Use port number accordingly&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_http_version 1.1;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Upgrade $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Connection &amp;#x27;upgrade&amp;#x27;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Host $host;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_cache_bypass $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_redirect off;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # Setting maximum size of http request from client (OPTIONAL. Default is 1M if not set)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # client_max_body_size 10M;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;To set up your custom domain, make sure to include &lt;code&gt;server_name yourDomain.com www.yourDomain.com;&lt;/code&gt; instead of &lt;code&gt;server_name _;&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Making changes to this file requires restarting nginx. Restart it.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl restart nginx&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nginx restart&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Tip: more commands for nginx&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; nginx -t                &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# check nginx syntax&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl start nginx   &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# start nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl stop nginx    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# stop nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl restart nginx &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# restart nginx&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; systemctl status nginx  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# view server status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;tail&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -30 /var/log/nginx/error.log &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# display error log for debugging&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point, you should be able to see your app running on server. Navigate to your &lt;code&gt;Public DNS(IPv4)&lt;/code&gt; i.e. &lt;code&gt;ec1-4-56-119-211.us-east-2.compute.amazonaws.com&lt;/code&gt;. Alternative is to go to &lt;code&gt;IPv4 Public IP&lt;/code&gt; i.e. &lt;code&gt;3.22.154.213&lt;/code&gt;.&lt;/p&gt;&lt;h2 id=&quot;5-set-up-your-custom-domain&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-set-up-your-custom-domain&quot; aria-label=&quot;5 set up your custom domain permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Set up your custom domain&lt;/h2&gt;&lt;p&gt;To set up a custom domain, make sure that you&amp;#x27;ve included your domains in nginx config file from the last step.&lt;/p&gt;&lt;p&gt;First, you need to create an Elastic IP address, &lt;strong&gt;static IPv4 address&lt;/strong&gt; which is reachable from the internet. Although you already have &lt;code&gt;IPv4 Public IP&lt;/code&gt;, this is subject to change as your instance gets rebooted unexpectedly, which will require you to keep changing &lt;code&gt;A (Alias)&lt;/code&gt; record on your domain provider.&lt;/p&gt;&lt;p&gt;In general, using Elastic IP is free as long as it constantly gets used by an instance. In other words, there is no charge unless you reserve and do not use. So, make sure that you don&amp;#x27;t create a duplicate Elastic IP. &lt;a href=&quot;https://aws.amazon.com/premiumsupport/knowledge-center/elastic-ip-charges/&quot;&gt;Learn more&lt;/a&gt;.&lt;/p&gt;&lt;h3 id=&quot;creating-elastic-ip-address&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#creating-elastic-ip-address&quot; aria-label=&quot;creating elastic ip address permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating Elastic IP Address&lt;/h3&gt;&lt;p&gt;On the left panel of EC2 dashboard, click &lt;code&gt;Elastic IPs&lt;/code&gt; under &lt;code&gt;NETWORK &amp;amp; SECURITY&lt;/code&gt; and click &lt;code&gt;Allocate Elastic IP address&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:315px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:48.37209302325581%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAABcklEQVQoz42RS0/CUBBG/e/GJ2rcKG2hYCNKW6TIu4oLEo1AaRGVxBjjyge40GiMj4XmeFsDwYUpN/ky92bmnnwzM1UsFjFMk3RaxzBMTDODbhhsbaeJqQmyWYtyuYxfN1SpVCKXywX/zEzmj6b8pK4bATCt6wHIf1uWhW1XRzC/zlcoMBZXmV9cYnY+wkJkmemZOZZWVokLd4VCYcxZaTKHu/k8shJHkmOB1qJS4LBW26dSFQ4rtnBZGbkLBfoJVbjRNI2NDY1UKkUymfy9b2pYepLsTmYECgV6nkfT7dJwT2g4Hm63x7GIR402brvFtVfl6uKM/dpBMILhLP8FDvr38P4ArwP4eILnG/h8BN4YP/V6HX88ocD+nQDcdvi6OoT7c7gTGvTg5RK+3/4A85MAG81m0HKrcyriCY6ILa9L0+nQclxc16HXbbNn25O17CdkWWE9GhWSUBRFLEkVG5dZW5dIxBV2E3MULUOAyqFL+QEcznBbdzR05QAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 2&quot; title=&quot; 2&quot; src=&quot;/static/a16c0e9aa6460d8e1c532468356c7605/6bdcf/_2.png&quot; srcSet=&quot;/static/a16c0e9aa6460d8e1c532468356c7605/2eb24/_2.png 215w,/static/a16c0e9aa6460d8e1c532468356c7605/6bdcf/_2.png 315w&quot; sizes=&quot;(max-width: 315px) 100vw, 315px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:342px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:43.72093023255814%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABu0lEQVQoz22Su24TQRSG9xV4E6Di0lAgSl6DGglRR0KgQBLHdnyBgEQcsDF73/XaXl/o8gBBIikoES4cR14n2U1sB+ljZmzAGIpP5/y/zozOnDOaYZgYpoluGFSrVRw/IO595eLwE8lBh/OD9pzOn3jYneuZl3xpM/m2T7/fRysUX5ErFClXPlDaeYvf3eP44yMGDzRG+ftEz28KbjFcvUG0fofoxW2GT64yfHqdUfoe0eZdBg+vCH2N/uAYrbT7jp3SLhVxYaVSxg5CTj83iO3HxJ0UiaS9TtxaI+lKvUHSfEYSrs50N00SrDDd2+ZIXui6Lq7n4Yho2Tb1ep3oLCG+hJPziSIe/1CcJBNOL6YMz8bCnyodjy85GiX0BiN6ve9onuej8Gf4tRphGNJuhTQbDQKhm426wvNcgqCGZRr4Ipe6FTYpl8sUiy9VvWZZFouYAkMs6BemWJjy51Fii5f8rhe+1K7rKK1JsYjjOH9hSxb85fpltLWNFHmx5e3Xb/45ILXs4L14ksxlB9mtPJuZLJmtHKl0hly+oKLy01k0XdeRf9E0rf92sNyZHIM8I/+tPh+JyvXZiH4CBi8xSFo8MRYAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 3&quot; title=&quot; 3&quot; src=&quot;/static/dc32c0b9d59508d48a592607dc3ed39f/e2c15/_3.png&quot; srcSet=&quot;/static/dc32c0b9d59508d48a592607dc3ed39f/2eb24/_3.png 215w,/static/dc32c0b9d59508d48a592607dc3ed39f/e2c15/_3.png 342w&quot; sizes=&quot;(max-width: 342px) 100vw, 342px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Click &lt;code&gt;Allocate&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:46.97674418604651%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABT0lEQVQoz42QTU7DMBCFe3IuAf1JmsSJ0/w6jts0RQhViLLjApyADQIJcYLHjOM27aKCxZfxOOM3b2biBwHuZjMsPB/T2Rye72O+8HA7nSKWElmeY5URuSMbGO4zG6u6Rq2UjZNQxPCXAbwghBdJLEWCOJEQcYIgjLAkhhgiiITN7V0Unf6XVTUK5kWBmB4n5CaWqRXigrZtoYn2HxzFOE6KooQQ4kSartA0DTabDdbr9Z9wXaP1KFjR57QP2o0iMRa8cGHMSGsunLMo56NDpSFXGWSaIqUYJ4lt0HWd7W6dOvjM99vt1tL3vYUbsZgVNJSwq5I6JIVCoVoY15UL9ZlD7RyxCAvaBoQioaIsB0Eusjvg0asGVaNhzkckjON4Poo+PR+IFzzu9+h3O7dDnt3NP1DbfVyDp5GpRHf/gO/XGl/mBj9vB7x/fNLuFX4BLlwbO1CYzxkAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 4&quot; title=&quot; 4&quot; src=&quot;/static/49c526c4ad75b9631d2d356b7b0e017c/914ae/_4.png&quot; srcSet=&quot;/static/49c526c4ad75b9631d2d356b7b0e017c/2eb24/_4.png 215w,/static/49c526c4ad75b9631d2d356b7b0e017c/05ed2/_4.png 430w,/static/49c526c4ad75b9631d2d356b7b0e017c/914ae/_4.png 860w,/static/49c526c4ad75b9631d2d356b7b0e017c/f6f78/_4.png 932w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
Click created IP address (i.e. 3.132.123.28). Then click &lt;code&gt;Associate Elastic IP address&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:702px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:17.209302325581397%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAtklEQVQI113Ly0pDMRhF4fP+c7XYy5+TnlxOkia2gxYLFpEK2gtFBKGDij7JMiNBBx97sFlN5wM2JKzpcM5yVwo5z6r8K8ZACD1KCaIUIoLWmllK9YsYa2vrKLVtbk1k5AvaBVoX6csCn+d/mJBZbp54eDmy3R9Zb1/rnpiv1kjnuRoKg4lmpA3Ndeu4aT3aJ5RLiA3/RMY1Wj4+czh/8Xb+ZPdx4f3yzeJ+w6TrGWrLeOoZyJQfYjm1l/yW3WIAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 5&quot; title=&quot; 5&quot; src=&quot;/static/092b0dbd5d033f2647a65e4ec261ea58/d6331/_5.png&quot; srcSet=&quot;/static/092b0dbd5d033f2647a65e4ec261ea58/2eb24/_5.png 215w,/static/092b0dbd5d033f2647a65e4ec261ea58/05ed2/_5.png 430w,/static/092b0dbd5d033f2647a65e4ec261ea58/d6331/_5.png 702w&quot; sizes=&quot;(max-width: 702px) 100vw, 702px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:544px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:37.674418604651166%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABP0lEQVQoz3WSy07CQBSG+4i6URe48oFILBBtpFQuhV5mpldESNCNCxNduPAdIEoTnuD3zIHRxsDiyz89M+efOefUCqMIhiAM0R8M0Gq1Yds2Wu0OpmWJbf8Km/YJqu4lKucc1V0D1e0ZfTewcS6wvTnF59sLRpMQljapM/J9uD0PXddFz/OwWMzxtXSwmjaxnnewfrRZVw9NXq9mNr7n1/h4fyXDAFYsBOoIQioFRQgpd+vZkng6okvI2TMiIflBlqIknaxVHiOOiBCCkEy0191aRAGb6bZZKknYMCHN0hTpnqQWN+j4/5hGV2FmYOV5jqIoaCPl/g1HPvzxmF6mOG7241hgQj0qaUgmZjTLsj9DfUCjb+cecpmKD9WTfH/MQwqC8Nf0oKHn3dOvMuSNsixgLqibadWlif3QTOyQ4Q8y8uaY5aU/7QAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 6&quot; title=&quot; 6&quot; src=&quot;/static/2664a748238d91d2e6a6410fe87faf36/b3e51/_6.png&quot; srcSet=&quot;/static/2664a748238d91d2e6a6410fe87faf36/2eb24/_6.png 215w,/static/2664a748238d91d2e6a6410fe87faf36/05ed2/_6.png 430w,/static/2664a748238d91d2e6a6410fe87faf36/b3e51/_6.png 544w&quot; sizes=&quot;(max-width: 544px) 100vw, 544px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Select your Instance and hit &lt;code&gt;Associate&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:66.97674418604652%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAABzUlEQVQ4y41TW3LaQBDknr5DTuC/fOQA+YiRsUHv50pIIFVYXkUVGN/EsXMA5wd3ZkYPi5hUWVWt3tmdbY1meweO62JoGDBuRzBGI9wMDYpv8WM4xA3N87rjerAdF2EUIUkS4X8RxbHwIAgjjCcm7sdj3N3dww8CxLQpbhI4Zni+L/NpmgonPbRizAN++ZTMcKka3jCbzZDn+QdMp9MPyAlt1bUgBWPTpionyGgxzTIoEmVhZqVS2Tifz+VDLbfgmPM6wThR8KOYqvPkS5xQluU5qhJVVRFXEvNY4rIWPxdUClkcwbYsqXLSg2lamJjm+zyNW3DfbS9AXhQkqN4FWX272UDrJRZaQy+XWBI41sK6m5e11UrWV+sN5j81tSk/r5B/8fnlN06nE/hp+X/P6e0Nr69/ZPzr6Un6y33vBLn5q/Uai4XGdrvF/nDAfr8nHGpQfDweOzw8HJu5R+x2O+lhen4oiXiMjcsGdj0fQRgiooOKmqSMKuijswxZ6cIpJ7UHPa9JbHxHzb7kxRoFClpnsYuCQRDKidqOA9t24BBblk3s1l7s+7IZywUo2IclUtUTbAefBV9Jj68i36pvX5BcXyH9/hWhyqhFIf4CdB0gdbP98ksAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 7&quot; title=&quot; 7&quot; src=&quot;/static/81e5705df9f12b2afda5a75b8516341d/914ae/_7.png&quot; srcSet=&quot;/static/81e5705df9f12b2afda5a75b8516341d/2eb24/_7.png 215w,/static/81e5705df9f12b2afda5a75b8516341d/05ed2/_7.png 430w,/static/81e5705df9f12b2afda5a75b8516341d/914ae/_7.png 860w,/static/81e5705df9f12b2afda5a75b8516341d/6bff2/_7.png 957w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Your Elastic IP is created and associated with your instance.&lt;/p&gt;&lt;b style=&quot;color:#f73d3d&quot;&gt;IMPORTANT&lt;/b&gt;: After this step, your `Public DNS(IPv4)` and `IPv4 Public IP` will reset to a new value. You must use the new public DNS to connect to your instance on ssh.&lt;h3 id=&quot;add-records-to-your-domain-provider&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-records-to-your-domain-provider&quot; aria-label=&quot;add records to your domain provider permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add records to your domain provider&lt;/h3&gt;&lt;p&gt;Grab new &lt;code&gt;Public DNS&lt;/code&gt; and &lt;code&gt;Elastic IP&lt;/code&gt; and navigate to your domain provider&amp;#x27;s website (i.e namecheap, GoDaddy, Bluehost, etc). On the DNS setting page, add two following records.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:402px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:32.558139534883715%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAAA9UlEQVQoz31Ra3ODIBD0//9CPzjaWDA8FNGIbaKy4a7D1Dad7sxyPO72FiiQEGPENE0YhoFpjEHf95jnGdu+cyTSGe0TKX9dV3jvkUE6BQ0ESu66DtZaKKWgtcY4jqkooKoqtG2LpmnQXt5Q1zXvlWXJJPFlWb4Es3KOx3EwaR5TvD82KG0gpcS7kBDKctPslsTIvXPu22EWpAQqJCfkwrkB9x2QeoC6dlAm3cJv+A/F+f4Z1F0IwV3TyUtRNvEXi/OCQO9G7kjQWpMcRkjj2eFVW1zsiv2IP4TP8xeHIQT+Zc8PfePiW/jkz1nCB6bwwHES+Y0nNJAc5WtfQq4AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 8&quot; title=&quot; 8&quot; src=&quot;/static/a8e5748278e5720fc6b2913236487739/0ec92/_8.png&quot; srcSet=&quot;/static/a8e5748278e5720fc6b2913236487739/2eb24/_8.png 215w,/static/a8e5748278e5720fc6b2913236487739/0ec92/_8.png 402w&quot; sizes=&quot;(max-width: 402px) 100vw, 402px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:26.976744186046513%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAwElEQVQY02VQ0RKDIAzj/3903gREBQREs7Q37tztITQlbWgx131jTwlHrTivSyF5PU/FnjI6a1rvP5C6XIrWjD7xMnKMZuHSLGIXkFvnkI4DN6D6E2JcWlOej4JGbnrnFDHCrytyzqicNHLCQpPCCaZpgrUWiZrcC6R+5D4E7VmWRftNYeKZWO81rtuGheaBcfD3PMNRE9gvxChQc4zbvmPmo/KAubhKXgPi9EJ0VqdqXLdynTr+jPkfHtqoky/6AL5NhS5sdkB7AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot; 1&quot; title=&quot; 1&quot; src=&quot;/static/762ef7f80d731d2929d825065bde027c/914ae/_1.png&quot; srcSet=&quot;/static/762ef7f80d731d2929d825065bde027c/2eb24/_1.png 215w,/static/762ef7f80d731d2929d825065bde027c/05ed2/_1.png 430w,/static/762ef7f80d731d2929d825065bde027c/914ae/_1.png 860w,/static/762ef7f80d731d2929d825065bde027c/91b29/_1.png 983w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Changing records may take some time (typically a few minutes) depending on the domain registrar. Make sure that your website is accessible (both www and naked domain) before proceeding to the next step.&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;6-set-up-your-ssl-certificate-https&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#6-set-up-your-ssl-certificate-https&quot; aria-label=&quot;6 set up your ssl certificate https permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;6. Set up your SSL certificate (HTTPS)&lt;/h2&gt;&lt;h3 id=&quot;install-certbot&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-certbot&quot; aria-label=&quot;install certbot permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install certbot&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Install certbot&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~ &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; add-apt-repository ppa:certbot/certbot &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Then press enter for prompt&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; update &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; python-certbot-nginx &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Then press Y&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Run certbot after installation&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; certbot --nginx -d yourDomain.com -d www.yourDomain.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It&amp;#x27;ll prompt you with..&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Enter your email&lt;/li&gt;&lt;li&gt;Press &amp;quot;A&amp;quot; to agree&lt;/li&gt;&lt;li&gt;Y/N whether to share your email&lt;/li&gt;&lt;li&gt;Press 2 to redirect traffic&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Certbot will automatically insert codes inside nginx configuration file:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;nginx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-nginx&quot;&gt;NGINX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-nginx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location / {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # Connect node api&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_pass http://127.0.0.1:8080;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_http_version 1.1;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Upgrade $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Connection &amp;#x27;upgrade&amp;#x27;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Host $host;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_cache_bypass $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_redirect off;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    listen 443 ssl; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ssl_certificate /etc/letsencrypt/live/yourDomain.com/fullchain.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ssl_certificate_key /etc/letsencrypt/live/yourDomain.com/privkey.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = www.yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return 404; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;this-is-it-save-default-and-run-sudo-systemctl-restart-nginx-to-apply-change&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#this-is-it-save-default-and-run-sudo-systemctl-restart-nginx-to-apply-change&quot; aria-label=&quot;this is it save default and run sudo systemctl restart nginx to apply change permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;This is it! Save &lt;code&gt;default&lt;/code&gt; and run &lt;code&gt;sudo systemctl restart nginx&lt;/code&gt; to apply change&lt;/h3&gt;&lt;h2 id=&quot;create-a-scheduler-to-automatically-renew-your-certificate&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-a-scheduler-to-automatically-renew-your-certificate&quot; aria-label=&quot;create a scheduler to automatically renew your certificate permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create a scheduler to automatically renew your certificate&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; select-editor &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Choose your favorite editor&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;crontab&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -e&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Insert this &amp;amp; save&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token number&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;23&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; * * * /usr/bin/certbot renew --quiet&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Your Ubuntu machine will run &lt;code&gt;/usr/bin/certbot renew --quiet&lt;/code&gt; every day at 11:11PM for auto renewal of SSL certificate. Read &lt;a href=&quot;/2020/03/launchd-2&quot;&gt;this post&lt;/a&gt; to learn more about cron jobs.&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;enabling-maintenance-mode-for-your-app-with-nginx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#enabling-maintenance-mode-for-your-app-with-nginx&quot; aria-label=&quot;enabling maintenance mode for your app with nginx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Enabling maintenance mode for your app with Nginx&lt;/h2&gt;&lt;h3 id=&quot;maintenancehtml-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#maintenancehtml-example&quot; aria-label=&quot;maintenancehtml example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;maintenance.html example&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:466px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:45.58139534883721%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABX0lEQVQoz22S204CQQyGeQpdYBeYFjHKQZAYo8hpBSQERQHBACqJibcmXvvuv+3OLlmJF/+2nbbfdHYmQUQwxoDF5tmKVRTaff8/hQxlJSIn7RocOAaHSQNH5HoGyZRBKm2CnPpOKF1Tq2tJ8V3XMpSVULqXMZgMCT9fjO9PxnrGuG0R3heM8YAw6hHm94yNrL89c1C7nDBmY8LTiILaTDacUD8a9NqE9ZTx8sjYLhlDXyBhg/qvAtrKBqspYfFA+FjJBnON7aY61A6YyxmUTgmVEqF2RqhXKYjLRetHcbVi89WyzdUqtqd4Yhk7YFaCeo3Quib4Mv6dTNS4tLFON/QZ3Rub05P4TUJbcoOu1FwRLs6Fkd27FD22ju159kd3pWncZ3QahH7HggYdC28KJOXaWu2J/l9wKRS78rj0ORwXCIUjUczqWj4f1sTqd89mHxQl1OZEcRv3oxpj/vb/AmZADKfOxDXoAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;maintenance&quot; title=&quot;maintenance&quot; src=&quot;/static/9a5d46b285f81ee3df6307372a1eb85e/fc1a1/maintenance.png&quot; srcSet=&quot;/static/9a5d46b285f81ee3df6307372a1eb85e/2eb24/maintenance.png 215w,/static/9a5d46b285f81ee3df6307372a1eb85e/05ed2/maintenance.png 430w,/static/9a5d46b285f81ee3df6307372a1eb85e/fc1a1/maintenance.png 466w&quot; sizes=&quot;(max-width: 466px) 100vw, 466px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;en&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;UTF-8&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;viewport&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;width=device-width, initial-scale=1.0&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;http-equiv&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;X-UA-Compatible&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;ie=edge&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;YOUR_PAGE | Maintenance&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css selector&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css hexcode color&quot;&gt;#222&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css selector class&quot;&gt;.main-container-maintenance&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;top&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; Arial&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; Helvetica&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; sans-serif&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css hexcode color&quot;&gt;#fada26&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token style language-css property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css function&quot;&gt;translate&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;-50&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token style language-css number&quot;&gt;-40&lt;/span&gt;&lt;span class=&quot;token style language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token style language-css punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token style language-css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token style language-css&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;main-container-maintenance&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Offline for maintenance&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        This website is undergoing maintenance right now (·_·)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Please check back later!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;turning-onoff&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#turning-onoff&quot; aria-label=&quot;turning onoff permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Turning On/Off&lt;/h3&gt;&lt;p&gt;When the file exists, your app will only serve &lt;code&gt;maintenance.html&lt;/code&gt;. Make sure to put it under directory, &lt;code&gt;/opt/maintenance.html&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;To turn it on or off&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Turn ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; maintenance-.html maintenance.html&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Turn OFF&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; maintenance.html maintenance-.html&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;It may be convenient to create a shell script. For example, create &lt;code&gt;sudo vim /opt/on-maintenance.sh&lt;/code&gt; that contains above command. Make it executable with &lt;code&gt;sudo chmod +x on-maintenance.sh&lt;/code&gt;. Then run the script with &lt;code&gt;sh /opt/on-maintenance.sh&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;nginx-config&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#nginx-config&quot; aria-label=&quot;nginx config permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;nginx config&lt;/h3&gt;&lt;p&gt;Modify nginx config to detect whether there exists &lt;code&gt;/opt/maintenance.html&lt;/code&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /etc/nginx/sites-available/default&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;nginx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-nginx&quot;&gt;NGINX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-nginx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  location / {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if (-f /opt/maintenance.html) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      return 503;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # Connect node api&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_pass http://127.0.0.1:8080;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_http_version 1.1;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Upgrade $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Connection &amp;#x27;upgrade&amp;#x27;;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header Host $host;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_cache_bypass $http_upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    proxy_redirect off;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    listen 443 ssl; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ssl_certificate /etc/letsencrypt/live/yourDomain.com/fullchain.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ssl_certificate_key /etc/letsencrypt/live/yourDomain.com/privkey.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    # When /opt/maintenance.html is found&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    error_page 503 @maintenance;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    location @maintenance {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      root /opt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      rewrite ^(.*)$ /maintenance.html break;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;server {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = www.yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    if ($host = yourDomain.com) {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        return 301 https://$host$request_uri;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    } # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  listen 80;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  server_name yourDomain.com www.yourDomain.com;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return 404; # managed by Certbot&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;extra-make-deployment-easier-with-alias--shell-script&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#extra-make-deployment-easier-with-alias--shell-script&quot; aria-label=&quot;extra make deployment easier with alias  shell script permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extra: Make deployment easier with alias &amp;amp; shell script&lt;/h2&gt;&lt;p&gt;Deploying MERN stack application to EC2 instance requires many steps, but future deployments of the websites can be less painful if you utilize &lt;strong&gt;alias on your terminal&lt;/strong&gt; along with &lt;strong&gt;shell script on your EC2 instance&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;When making changes to your app, you would need to go through the following steps:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Build your client&lt;/li&gt;&lt;li&gt;Commit &amp;amp; push changes to GitHub repository&lt;/li&gt;&lt;li&gt;Clone it into your EC2&lt;/li&gt;&lt;li&gt;Install packages&lt;/li&gt;&lt;li&gt;Restart pm2&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;p&gt;You can alternatively pull it from repository and re-build on EC2 instance; however, I prefer building it on my own PC beforehand because it&amp;#x27;s faster.&lt;/p&gt;&lt;/div&gt;&lt;p&gt;First, create an alias on your terminal to take care of building your client and pushing changes to the repository.&lt;/p&gt;&lt;p&gt;You can read more about &lt;strong&gt;alias&lt;/strong&gt; in &lt;a href=&quot;https://ellismin.com/2019/04/alias/&quot;&gt;this post&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Example: Creating alias to build &amp;amp; push to repo&lt;/p&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;~/.bash_profile&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Make sure that you&amp;#x27;re script is defined to build React code i.e. &amp;quot;npm run build --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-name function&quot;&gt;buildpush&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; run build&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -a -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[PRODUCTION]&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, running &lt;code&gt;buildpush&lt;/code&gt; in your terminal takes care of the first two steps: &lt;strong&gt;Build your client&lt;/strong&gt;, &lt;strong&gt;Commit &amp;amp; push changes to GitHub repository&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Proceed to your EC2 instance and create the following shell script for the rest of the steps&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt/production.sh&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-code-title code-title-custom&quot;&gt;/opt/production.sh&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;shell&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-shell&quot;&gt;SHELL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-shell&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;# Remove this folder if exists&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -rf ~/production-prepare&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Make sure that you&amp;#x27;ve created GitHub SSH authentication on EC2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# This clones into home directory because cloning directly into /opt/ folder requires&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;#  typing GitHub username &amp;amp; password&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; clone git@github.com:GITHUB_USERNAME/REPO_NAME.git ~/production-prepare&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -rf /opt/production-prepare&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/production-prepare /opt/&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt/production-prepare &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 stop all&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Replace previous application&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /opt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;rm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -rf mern-demo &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;mv&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; production-prepare mern-demo &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pm2 start mern-demo/app.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After creating file, make it executable with &lt;code&gt;sudo chmod +x &amp;lt;FILE_NAME&amp;gt;&lt;/code&gt;. Then run the script with &lt;code&gt;sh &amp;lt;FILE_NAME&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;h2 id=&quot;more-notes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-notes&quot; aria-label=&quot;more notes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More Notes&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;To check remaining space in storage of EC2 instance, run &lt;code&gt;df -h&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[RK]: Ramen Kid Tutorial]]></title><description><![CDATA[1. Sign in Go to  contact  page and click the word,  LOVE  to go to sign in page Email: ramenkid.m@gmail.com Password: (Ask me)…]]></description><link>https://ellismin.com/2020/03/rk-tutorial/</link><guid isPermaLink="false">https://ellismin.com/2020/03/rk-tutorial/</guid><pubDate>Sat, 14 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;1-sign-in&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-sign-in&quot; aria-label=&quot;1 sign in permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Sign in&lt;/h2&gt;&lt;p&gt;Go to &lt;code&gt;contact&lt;/code&gt; page and click the word, &lt;code&gt;LOVE&lt;/code&gt; to go to sign in page&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Email:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;mailto:ramenkid.m@gmail.com&quot;&gt;ramenkid.m@gmail.com&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Password:&lt;/p&gt;&lt;p&gt;(Ask me)&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;2-announcement&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-announcement&quot; aria-label=&quot;2 announcement permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Announcement&lt;/h2&gt;&lt;p&gt;Once signed in, on &lt;code&gt;ADMIN PANEL&lt;/code&gt;, expand &lt;code&gt;Change Announcement&lt;/code&gt;. When you want to use announcement, click the tick mark and set whatever message. When not using it, disable it to leave it unchecked, then hit &lt;code&gt;save&lt;/code&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;May be useful to put things like..&lt;/p&gt;&lt;p&gt;Ex) Ramen Kid will be closing due to COVID-19!&lt;/p&gt;&lt;p&gt;Ex) Subscribe to our email list to get discount!&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Try putting an announcement and &lt;code&gt;save&lt;/code&gt; it to show how announcement bar looks like.&lt;/p&gt;&lt;h2 id=&quot;3-how-many-customers-have-visited-website&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-how-many-customers-have-visited-website&quot; aria-label=&quot;3 how many customers have visited website permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. How many customers have visited website?&lt;/h2&gt;&lt;p&gt;Located right below &lt;code&gt;Changed Announcement&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;Visitor counts&lt;/code&gt;: shows how many &lt;strong&gt;unique&lt;/strong&gt; customers have visited the website&lt;/p&gt;&lt;p&gt;&lt;code&gt;Page Views&lt;/code&gt;: shows how many times each page was clicked&lt;/p&gt;&lt;h2 id=&quot;4-change-your-emailpassword&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-change-your-emailpassword&quot; aria-label=&quot;4 change your emailpassword permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Change Your email/password&lt;/h2&gt;&lt;p&gt;I blocked changing email address for now, but you can change the password to whatever you want&lt;/p&gt;&lt;h2 id=&quot;5-edit-header-links&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-edit-header-links&quot; aria-label=&quot;5 edit header links permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Edit header links&lt;/h2&gt;&lt;p&gt;You can edit the menus. For example:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;If you don&amp;#x27;t want to use about page, disable it by unchecking &lt;code&gt;about&lt;/code&gt; then save&lt;/li&gt;&lt;li&gt;If you don&amp;#x27;t want customers to contact you through &lt;code&gt;contact&lt;/code&gt; page, disable contact&lt;/li&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;IMPORTANT&lt;/strong&gt;: If you disable &lt;code&gt;contact&lt;/code&gt; though, you will have to log in by manually typing in &lt;code&gt;ramenkid.com/signin&lt;/code&gt; because contact page will be gone&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;6-subscribers&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#6-subscribers&quot; aria-label=&quot;6 subscribers permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;6. Subscribers&lt;/h2&gt;&lt;p&gt;Click &lt;code&gt;SUBSCRIBE&lt;/code&gt; first here:&lt;/p&gt;&lt;p&gt;Any customers can sign up with their name and email then it will be saved here:&lt;/p&gt;&lt;p&gt;By Clicking &lt;code&gt;Send Emails&lt;/code&gt;, you can send out emails to all customers subscribed&lt;/p&gt;&lt;h2 id=&quot;7-home-page&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#7-home-page&quot; aria-label=&quot;7 home page permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;7. Home page&lt;/h2&gt;&lt;p&gt;Go to home page by clicking the logo:&lt;/p&gt;&lt;p&gt;Here, you can add / edit / delete images on your phone or on your computer. Change anything, however you&amp;#x27;d like&lt;/p&gt;&lt;h2 id=&quot;8-hours--location&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#8-hours--location&quot; aria-label=&quot;8 hours  location permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;8. HOURS &amp;amp; LOCATION&lt;/h2&gt;&lt;p&gt;Here you can change &lt;code&gt;address and phone number&lt;/code&gt; or &lt;code&gt;hours and extra message&lt;/code&gt;&lt;/p&gt;&lt;p&gt;Currently &lt;code&gt;Please be aware that last seating for dinner will be at 8:45PM&lt;/code&gt; is put. Remove it or change it to anything else if you&amp;#x27;d like by clicking &lt;code&gt;hours and extra message&lt;/code&gt;&lt;/p&gt;&lt;h2 id=&quot;9-menu&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#9-menu&quot; aria-label=&quot;9 menu permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;9. MENU&lt;/h2&gt;&lt;p&gt;Here you can add / edit / delete menu items&lt;/p&gt;&lt;p&gt;When adding menu:&lt;/p&gt;&lt;p&gt;&lt;code&gt;menu name&lt;/code&gt;, &lt;code&gt;category&lt;/code&gt;, &lt;code&gt;price&lt;/code&gt; are &lt;strong&gt;required&lt;/strong&gt;, and &lt;code&gt;image&lt;/code&gt; and &lt;code&gt;description&lt;/code&gt; are &lt;strong&gt;not required&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;Price&lt;/code&gt; does not have to be number so you can put something like &lt;code&gt;--&lt;/code&gt; when it&amp;#x27;s not applicable&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[React + Node.js]: Deploy Your MERN Stack App on Heroku]]></title><description><![CDATA[This post is to show how to deploy your MERN Stack (MongoDB, Express.js, React, Node.js) applications on Heroku. Heroku is one of the cloud…]]></description><link>https://ellismin.com/2020/03/deploy-mern-1/</link><guid isPermaLink="false">https://ellismin.com/2020/03/deploy-mern-1/</guid><pubDate>Fri, 13 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This post is to show how to deploy your MERN Stack (MongoDB, Express.js, React, Node.js) applications on Heroku. Heroku is one of the cloud services where you can deploy, manage, and scale modern applications.&lt;/p&gt;&lt;h2 id=&quot;prerequisite&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#prerequisite&quot; aria-label=&quot;prerequisite permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Prerequisite&lt;/h2&gt;&lt;p&gt;If you don&amp;#x27;t have MERN Stack project available, here is how you can set up a basic MERN stack application with REST API.&lt;/p&gt;&lt;h3 id=&quot;--react--nodejs-create-your-mern-stack-application---part-1-backend&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#--react--nodejs-create-your-mern-stack-application---part-1-backend&quot; aria-label=&quot;  react  nodejs create your mern stack application   part 1 backend permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;- &lt;a href=&quot;/2020/03/mern-1&quot;&gt;[React + Node.js]: Create your MERN Stack Application - Part 1: Backend&lt;/a&gt;&lt;/h3&gt;&lt;h3 id=&quot;--react--nodejs-create-your-mern-stack-application---part-2-frontend&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#--react--nodejs-create-your-mern-stack-application---part-2-frontend&quot; aria-label=&quot;  react  nodejs create your mern stack application   part 2 frontend permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;- &lt;a href=&quot;/2020/03/mern-2&quot;&gt;[React + Node.js]: Create your MERN Stack Application - Part 2: Frontend&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;You can also choose to &lt;a href=&quot;https://github.com/EllisMin/MERN-demo&quot;&gt;download the project&lt;/a&gt;. I&amp;#x27;ll be using this project to deploy on Heroku.&lt;/p&gt;&lt;h2 id=&quot;creating-your-app-on-heroku&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#creating-your-app-on-heroku&quot; aria-label=&quot;creating your app on heroku permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating your App on Heroku&lt;/h2&gt;&lt;p&gt;Go on &lt;a href=&quot;https://www.heroku.com/&quot;&gt;Heroku&lt;/a&gt; website to sign up/sign in. When you&amp;#x27;re signed in, create a new app with an app name
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:219px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:80%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB9klEQVQ4y41U2W7TUBD1F/I3fA8Sb4g3VFFVAgpFVERUakMXN4vtbF4au9737XBn0qRJcaJaGt07x+MzZ+6Mr4QDT9u2B/2uR9pHtP5YH7v4/O4Shuau3jXtQWJpO/OaiKxpVti3D7d4++Y9vn7ss9/UzU7C7f2Own3leXaM3ycDhF76X9w26V6FZVkKdSsVtVCz7wy7yJiQy3uSXZYVehd9/Pj1B5+OT3m9+ivj7l7B8ZefODu/wNW1jKOT7zjvXW6+a7bOtbMppJDI67pmW2Mrv0EYxkjTrLOZkuv5GI4nGIw0oWQMw1pCncyxMCyM1ClGygRz3YQ8VDGdG1joAlemArPQvxkwTrZOIGV5gUfXh7V0YDsuTEFIe0oURrFYA/hByEnMB5tj7UdPYBGTkgBKHsfJc8kUdCuPMFuYT5nvWa2izTGZ6YyTyQOFFd+IWHmosD9WZ3w8m5JpEycpoihBlucoRJeTNBWWoShKpFnGOBntCaNKIqEoCCPGq2qL8GXb86xEVdY8wHX1bOSv8Ub4RV51jtTOHGZpwV107Qi2GWCp+7z3hC0NH4Gb4GHhIQ6zTeKXM7lDmAtCCnSsALOR6PadCWPiQNccqLIJa+7iuqfxmiZUan34T6EBLYuKVa6wducyoFnczKmI2/vrvfZqes0V9w9lp9Sl+y1rmwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/06515fe4260455e253a5c1a0a94a13fd/e52b4/1.png&quot; srcSet=&quot;/static/06515fe4260455e253a5c1a0a94a13fd/2eb24/1.png 215w,/static/06515fe4260455e253a5c1a0a94a13fd/e52b4/1.png 219w&quot; sizes=&quot;(max-width: 219px) 100vw, 219px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;The app name you choose will later become have a default domain. i.e. &lt;code&gt;https://mern-demo-prod.herokuapp.com&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:361px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:87.90697674418604%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3ElEQVQ4y5WUTW/UMBCG/Wf5FVx6oX+BC4ILB8SVAypVJVQhhJAQcGr2I+0uG+fTjhPnc5vYL7ZFt1ohlmSiJ2NF9mRG846J1hqyqlHXjfNN28Ga/Q6N2Ua00ljdbnG7DXD3K0CSsaMNSqtZkH7swVuOTGZgNUNcJEgMsYiRlimKroAwFF05CdIOLYQUiGiEzGRHA4okThHSEHkuDpmOasSghv9C7GvJV1iLNW6Yh5VYweML+MJHUAVYsCU8tkDe5pB7ibIvIXv5T4itO25iZF2KqIlAK4qwoWAdA284QhkaIpfhpKYoZQJG5iBNkSY5clZiswnBWPHXZu3ark8+LmBZVUjyAlyUZl2DRimkkZG1YRwdo9k3BWIPpbyB8LdoKokoisE5RxwnDqvHORBbRF1UqE2XrbhzYWRiePDjqGZB3EScMGWEPwcX0EY+Sh2P64cxnFzyOCh434yYdwJ3npmOQCDwM2yXCcINx3D/Ry562mC7puy7Afve0N073zV7520wZbOfkSU59be5HT6U/PN6h68XPr68X+HTOw8f3vzA92v/8Rqbc3317YDX55/x8uwjXpxd4fnTCzx78havzi8PXZ6nQ3MgoxLUz00zOHZrhs1Ngiwsj8qear8BoAR1dhMV/QIAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/65dcf884696b9ddfaf34ef45c449b0f1/39d76/2.png&quot; srcSet=&quot;/static/65dcf884696b9ddfaf34ef45c449b0f1/2eb24/2.png 215w,/static/65dcf884696b9ddfaf34ef45c449b0f1/39d76/2.png 361w&quot; sizes=&quot;(max-width: 361px) 100vw, 361px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;After creating app, install &lt;code&gt;Heroku CLI&lt;/code&gt; from this &lt;a href=&quot;https://devcenter.heroku.com/articles/heroku-cli&quot;&gt;link&lt;/a&gt;. After installation of CLI, move onto the next time. We&amp;#x27;ll come back to Heroku later.&lt;/p&gt;&lt;h2 id=&quot;serve-indexhtml&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#serve-indexhtml&quot; aria-label=&quot;serve indexhtml permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Serve index.html&lt;/h2&gt;&lt;h3 id=&quot;current-file-structure&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#current-file-structure&quot; aria-label=&quot;current file structure permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Current file structure&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;c&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-c&quot;&gt;C&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-c&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── controllers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── front&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── src&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;css&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── custom&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;jsx&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;jsx&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;jsx&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;production&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;env&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── models&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── routes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Before deploying your app to Heroku, your server needs to be able to serve the minified version of &lt;code&gt;index.html&lt;/code&gt; that will later be created with &lt;code&gt;npm run build&lt;/code&gt; inside &lt;code&gt;mern-demo/front-end&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;You need to serve &lt;code&gt;index.html&lt;/code&gt; in &lt;code&gt;mern-demo/front-end/build&lt;/code&gt; directory. Modify &lt;code&gt;mern-demo/app.js&lt;/code&gt; accordingly.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;mern-demo/app.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mongoose&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./config&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userRoutes &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./routes/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;path&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Serves mern-demo/front-end/build statically&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set CORS header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-control-Allow-Origin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Methods&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;GET, POST, DELETE&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Headers&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Register Route&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userRoutes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;sendFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;index.html&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Error Handler&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; status &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Passing original error data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// DB connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mongoose&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useNewUrlParser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useUnifiedTopology&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useFindAndModify&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Listening on port &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;create-production-build&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-production-build&quot; aria-label=&quot;create production build permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create Production Build&lt;/h2&gt;&lt;p&gt;Now that &lt;code&gt;mern-demo/front-end/build&lt;/code&gt; is being served.. but it is empty. Define another script to build front-end in &lt;code&gt;mern-demo/package.json&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;install-client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm i --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node app.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;nodemon app.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm start --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dev&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;concurrently \&amp;quot;npm run server\&amp;quot; \&amp;quot;npm run client\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;build-client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm run build --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;(Optional): if you want to prevent users from viewing your React source code via inspect, you can add an option to production build inside &lt;code&gt;mern-demo/front-end/package.json&lt;/code&gt;. Change &lt;del&gt;&lt;code&gt;&amp;quot;build&amp;quot;: &amp;quot;react-scripts build&amp;quot;&lt;/code&gt;&lt;/del&gt; to &lt;code&gt;&amp;quot;build&amp;quot;: &amp;quot;GENERATE_SOURCEMAP=false react-scripts build&amp;quot;,&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;define-your-fetch-url-in-envproduction&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#define-your-fetch-url-in-envproduction&quot; aria-label=&quot;define your fetch url in envproduction permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Define your fetch url in &lt;code&gt;.env.production&lt;/code&gt;&lt;/h3&gt;&lt;p&gt;Before running the build script, make sure to have fetch url updated to your app name on Heroku for production in &lt;code&gt;mern-demo/front-end/.env.production&lt;/code&gt;. For example:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;.env.production&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;REACT_APP_FETCH_URL=https://mern-demo-prod.herokuapp.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Make sure NOT to include &lt;code&gt;/&lt;/code&gt; at the end because our code fetches with..&lt;/p&gt;&lt;p&gt;&lt;code&gt;fetch(process.env.REACT_APP_FETCH_URL + &amp;quot;/user&amp;quot;)&lt;/code&gt; which already contains &lt;code&gt;/&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;When you&amp;#x27;re done, run the following command &lt;strong&gt;inside&lt;/strong&gt; &lt;code&gt;mern-demo&lt;/code&gt; directory&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; run build-client&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Confirm that &lt;code&gt;mern-demo/front-end/build&lt;/code&gt; contains the production build file&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;whitelist-ip-on-mongodb&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#whitelist-ip-on-mongodb&quot; aria-label=&quot;whitelist ip on mongodb permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Whitelist IP on MongoDB&lt;/h2&gt;&lt;p&gt;Whitelist IP on MongoDB defines which IP addresses can have access to your cluster. In other words, you can specify IP addresses that can fetch/add/delete users--you can think of it as an extra layer of security. Here I&amp;#x27;ll &lt;code&gt;allow access from anywhere&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:423px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:65.5813953488372%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAACO0lEQVQ4y21TSZLTQBDU6wj+QhDwgzlhgiDmwjLgTdauXrULbz/wyT/w4PGBMDYDL0iqeywPGBSRqi6pOzsru9rRhcYgcjFJA2Slhr4E/S+KAlVdQ9BYEkSu/gvzz/FVgNc3b/Hq4xt8CG7gaQ+udB8hXCLM7WRfJ0hyDlZICNpMVPohnqHgKGL2SV3EY0QiRiITMM1oRwGecYuSFBp1CY19mhOnKUbDMXzPx+dPfXiuB2/i2dwpyxJhFCFOEkRxDC4EdJahKAtbqi23KMELRZC2NEXkSiswwSGUhKRxF52avJEZeZMp6DxH0zQw3zpUVWVJy6rEiIfoJwEhJCuooowh1AbpOTolLRhFPiFALBjatiU0ltiSVzUy2mgx/YIXvfd48uwKT59f4WXvHZazKW1Yo6kf4RgFYUS+xAlSxhHY8lNSVVp1ncKmbhApjt7QxfWQ4XqUQuYV2ouKnNVqhbvdDpvbW3zdbrG9u8OO8uPxiM1mYycZQhvLHB55HTOFIJXkY/aPRc56vcbhxz323w84Uvy23+P+5y+Y53A4nAmr04LWgCxpm1NuLWotsYmOeRV00gZm0XK5xGKxwHw+x2w2sx52Ck1HeD61Sr8PPwjAOEd/MMBoPIaUEhPPe/BQUKsIIS063wz+POUuNwektUZO0XwXRGRgcqWobYyqkKfU3DFds/wsv0NH2Ck0qkyvcoqGxFQxnU7PpVvCmDMELKE+zP46tUvCjBredek6uhOMKZqLIE7kthNo/m/adRhpT5dmTgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/5c0b378345b803ec0f752fc13249abb1/f687d/5.png&quot; srcSet=&quot;/static/5c0b378345b803ec0f752fc13249abb1/2eb24/5.png 215w,/static/5c0b378345b803ec0f752fc13249abb1/f687d/5.png 423w&quot; sizes=&quot;(max-width: 423px) 100vw, 423px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:665px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:55.348837209302324%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAABZElEQVQoz51Tu07EMBDMB/I9/AYfQUVNRUtPQYVEh+DyuDztOGfn4Qw7zjk6rgIsjbyKvbOzO06i+x5106Cua5RVFeK2baG1xrqufwJXMs8zxnFE3COmadov/Xbx/k7oziTEeBG7UGDaz51z231nYSV2Id6+BYVs8ViWKI7HHVVVIy8KpFmGTBD2PEeapkiLEl+lQlq2GAYjGGDMgNPJboS9MSGZCEkkSLNQ+T8rEB6kMskqMabrOjRiCtvzy4JJRjL/Et57JIskKXG0F7fHK1VKqdAmHbfWSlunH2C7EUaEMT+Y0ooqfoxORXd5iYpJzP0SLBJJjUCbXsbkkFAmq9PJ60X3mMBEK0O3VHZWxJz4IrCIAI+AQBgxz8vFTBZwHPHM8clMI/zq94I8XxeP9+4Tz9krPvocCauwNa178K9RSod2tnhrNbyEpsKhOmKw2/OQwaDpWqi6w93LA24eb3H/9oRvJEtU6Ufs66gAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/1f3100850aa3804d518a949259b07182/5f4af/6.png&quot; srcSet=&quot;/static/1f3100850aa3804d518a949259b07182/2eb24/6.png 215w,/static/1f3100850aa3804d518a949259b07182/05ed2/6.png 430w,/static/1f3100850aa3804d518a949259b07182/5f4af/6.png 665w&quot; sizes=&quot;(max-width: 665px) 100vw, 665px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;back-on-heroku&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#back-on-heroku&quot; aria-label=&quot;back on heroku permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Back on Heroku&lt;/h2&gt;&lt;p&gt;We&amp;#x27;re ready to push our project to Heroku. If you have your project stored in git repository, add heroku remote &amp;amp; push&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;heroku git:remote -a &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;YOUR_APP_NAME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push heroku master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Make sure to update your .gitignore to exclude any sensitive information&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Otherwise, if you don&amp;#x27;t have your git repository set up, run the following inside &lt;code&gt;mern-demo&lt;/code&gt; folder to create repository for Heroku&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; init &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; heroku git:remote -a &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;YOUR_APP_NAME&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Make sure to have &lt;a href=&quot;https://devcenter.heroku.com/articles/heroku-cli&quot;&gt;Heroku CLI&lt;/a&gt; installed&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Finally, to push your project,&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -am &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[INITIAL]: initial commit&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push heroku master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Make sure to update your .gitignore to exclude any sensitive information&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;That&amp;#x27;s it!&lt;/strong&gt; Your app will soon be able to available on &lt;code&gt;https://&amp;lt;YOUR_APP_NAME&amp;gt;.herokuapp.com&lt;/code&gt;, as soon as build is complete on their end. You can view the building status on the &lt;code&gt;Overview&lt;/code&gt; tab.&lt;/p&gt;&lt;h2 id=&quot;post-build-script&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#post-build-script&quot; aria-label=&quot;post build script permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Post Build Script&lt;/h2&gt;&lt;p&gt;Don&amp;#x27;t like running build script for your client code every time before deploying your app? There is an easier way by adding post build script in &lt;code&gt;mern-demo/package.json&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;install-client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm i --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node app.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;nodemon app.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm start --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dev&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;concurrently \&amp;quot;npm run server\&amp;quot; \&amp;quot;npm run client\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;build-client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm run build --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;heroku-postbuild&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;NPM_CONFIG_PRODUCTION=false npm i --prefix front-end &amp;amp;&amp;amp; npm run build --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The added post-build script gets run on their server every time after you push your project to Heroku by &lt;code&gt;git push heroku master&lt;/code&gt;. Therefore, you don&amp;#x27;t have to run &lt;code&gt;npm run build&lt;/code&gt; on your own.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Caveat: If you have &lt;code&gt;.env.production&lt;/code&gt; included in &lt;code&gt;.git-ignore&lt;/code&gt; file, you would have to exclude it because Heroku needs to have access to the file to grab environment variables (for server side). If it&amp;#x27;s sensitive information, you shouldn&amp;#x27;t have it on the client side but to have it as config variable described below&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;including-environment-variables&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#including-environment-variables&quot; aria-label=&quot;including environment variables permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Including environment variables&lt;/h2&gt;&lt;p&gt;If you happen to have environment variable set up &lt;strong&gt;for your server side&lt;/strong&gt;, you can add those variables by going to &lt;code&gt;Settings&lt;/code&gt; tab and clicking &lt;code&gt;Reveal Config Vars&lt;/code&gt;. Alternatively, you can view those variables by typing &lt;code&gt;heroku config&lt;/code&gt; in command line interface.&lt;/p&gt;&lt;h2 id=&quot;more-notes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-notes&quot; aria-label=&quot;more notes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More Notes&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;You can add your &lt;strong&gt;custom domain&lt;/strong&gt; with Heroku at no cost; however, in order to configure SSL encryption with Heroku, you would need to purchase &lt;a href=&quot;https://www.heroku.com/pricing&quot;&gt;paid dyno&lt;/a&gt;. The default subdomain &lt;code&gt;&amp;lt;YOUR_APP_NAME&amp;gt;.herokuapp.com&lt;/code&gt; already contains SSL encryption.&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[React + Node.js]: Create your MERN Stack Application - Part 2: Frontend]]></title><description><![CDATA[Overview This post is continuation of  this post  to create a MERN (MongoDB, Express.js, React, Node.js) Stack Application. Part 2 will…]]></description><link>https://ellismin.com/2020/03/mern-2/</link><guid isPermaLink="false">https://ellismin.com/2020/03/mern-2/</guid><pubDate>Thu, 12 Mar 2020 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;This post is continuation of &lt;a href=&quot;/2020/03/mern-1&quot;&gt;this post&lt;/a&gt; to create a MERN (MongoDB, Express.js, React, Node.js) Stack Application. Part 2 will focus on setting up &lt;strong&gt;the client side&lt;/strong&gt; with React. If you haven&amp;#x27;t previously set up the MongoDB, Express.js, Node.js, please go through the Part 1 first.&lt;/p&gt;&lt;h2 id=&quot;front-end-set-up-react&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#front-end-set-up-react&quot; aria-label=&quot;front end set up react permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Front-end Set Up (React)&lt;/h2&gt;&lt;p&gt;Go to the root directory, &lt;code&gt;mern-demo&lt;/code&gt;, and we&amp;#x27;ll develop our front-end code in a directory &lt;code&gt;front-end&lt;/code&gt;. In the &lt;code&gt;mern-demo&lt;/code&gt; root directory, install create-react-app.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;npx create-react-app front-end&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;current-file-structure&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#current-file-structure&quot; aria-label=&quot;current file structure permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Current file structure&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;c&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-c&quot;&gt;C&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-c&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── front&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;end &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;all client side codes &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── controllers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     └── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── routes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     └── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── models&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     └── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── package&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;json&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;create-react-app&lt;/code&gt; creates &lt;code&gt;.git-ignore&lt;/code&gt; file in &lt;code&gt;front-end&lt;/code&gt; directory. If you plan to push anything on a repository, move &lt;code&gt;.git-ignore&lt;/code&gt; out of &lt;code&gt;front-end&lt;/code&gt; and place it under &lt;code&gt;mern-demo&lt;/code&gt;, root directory. i.e. &lt;code&gt;mv front-end/.git-ignore .&lt;/code&gt; By doing so, &lt;code&gt;.git-ignore&lt;/code&gt; will be applied to the whole project.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;package.json&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Open back &lt;code&gt;mern-demo/package.json&lt;/code&gt; to add more scripts--you do not need to modify &lt;code&gt;mern-demo/front-end/package.json&lt;/code&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node app.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;nodemon app.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;install-client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm i --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;client&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm start --prefix front-end&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dev&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;concurrently \&amp;quot;npm run server\&amp;quot; \&amp;quot;npm run client\&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;npm run install-client&lt;/code&gt; will install npm packages inside &lt;code&gt;mern-demo/front-end/package.json&lt;/code&gt;. This is equivalent to &lt;code&gt;cd front-end &amp;amp;&amp;amp; npm i&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;npm run client&lt;/code&gt; is equivalent to running &lt;code&gt;cd front-end &amp;amp;&amp;amp; npm start&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;npm run dev&lt;/code&gt; this command will now run both front and back end servers concurrently&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;env--envproduction&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#env--envproduction&quot; aria-label=&quot;env  envproduction permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;.env &amp;amp; .env.production&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;c&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-c&quot;&gt;C&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-c&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── front&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;end &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;production &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;env &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create &lt;code&gt;.env&lt;/code&gt; to contain environmental variables. If you&amp;#x27;re going to deploy your app later, create &lt;code&gt;.env.production&lt;/code&gt; as well. Remember to add &lt;code&gt;.env*&lt;/code&gt; inside &lt;code&gt;.git-ignore&lt;/code&gt; if you&amp;#x27;re uploading your project somewhere.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;front-end/.env&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;REACT_APP_FETCH_URL=http://localhost:8080&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;front-end/.env.production&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;REACT_APP_FETCH_URL=&amp;lt;YOUR_URL_ON_PRODUCTION&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;React will use variables in &lt;code&gt;.env&lt;/code&gt; on development, but on &lt;code&gt;npm run build&lt;/code&gt;, it will grab variables from &lt;code&gt;.env.production&lt;/code&gt; instead.&lt;/p&gt;&lt;p&gt;After you save the variable inside &lt;code&gt;.env*&lt;/code&gt;, you need to &lt;strong&gt;restart the server&lt;/strong&gt; for it to take effect&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;front-endsrc&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#front-endsrc&quot; aria-label=&quot;front endsrc permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;front-end/src/..&lt;/h2&gt;&lt;p&gt;Inside &lt;code&gt;front-end/src&lt;/code&gt;, we&amp;#x27;ll create a few components: CustomButton, User, UserAddForm. Then, tweak the default files &lt;code&gt;App.js&lt;/code&gt; and &lt;code&gt;App.css&lt;/code&gt; for styling.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;c&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-c&quot;&gt;C&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-c&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── front&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── src&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;css &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;js &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── custom&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;jsx &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;jsx  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    ├── user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;jsx &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;production&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     ├── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;env&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;     └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;user.jsx&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./custom-button&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; id&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; occupation&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; attr&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; handleDelete&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; loading &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt;attr &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation string&quot;&gt;&amp;quot;attr&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;attr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;remove&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript function&quot;&gt;handleDelete&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          X&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;custom-button.jsx&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; children&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; remove&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; loading&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; disabled&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;others &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt;remove &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation string&quot;&gt;&amp;quot;btn-delete&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt; btn-custom&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;disabled&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;disabled &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; loading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag spread punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token tag spread&quot;&gt;others&lt;/span&gt;&lt;span class=&quot;token tag spread punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;user-add-form.jsx&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./custom-button&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;FormInput&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;otherProps &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;group&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;input-custom&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag spread punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token tag spread&quot;&gt;otherProps&lt;/span&gt;&lt;span class=&quot;token tag spread punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; otherProps&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;otherProps&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;USER_FORM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;UserAddForm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; loading&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; handleAdd &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userForm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUserForm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;USER_FORM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; updatedForm &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userForm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUserForm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;updatedForm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handleAdd&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userForm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUserForm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;USER_FORM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;form-add-user&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript function&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;FormInput&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userForm&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;FormInput&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userForm&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;age&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;FormInput&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;userForm&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;occupation&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        Add&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CustomButton&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;UserAddForm&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;App.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useState&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; useEffect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;UserAddForm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./user-add-form&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./App.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;addLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setAddLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;deleteLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setDeleteLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;useEffect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetchUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;fetchUsers&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;GET&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Fetching user failed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; resData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;resData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleAdd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;formData&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAddLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;POST&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token string-property property&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;application/json&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; formData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; formData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; formData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;201&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Adding user failed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; resData &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; updatedUsers &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;resData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;updatedUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAddLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleDelete&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setDeleteLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;REACT_APP_FETCH_URL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/user/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;DELETE&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Deleting user failed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; updatedUsers &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;_id&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;updatedUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setDeleteLoading&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;MERN Stack App Demo&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;hr&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Add User:&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;UserAddForm&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;addLoading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;handleAdd&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleAdd&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;hr&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Users:&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Age&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Occupation&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;_id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;_id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;handleDelete&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleDelete&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;loading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;deleteLoading&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;App.css&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-css&quot;&gt;CSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-css&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector class&quot;&gt;.App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;max-width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;468&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#eee&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; sans-serif&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -apple-system&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; BlinkMacSystemFont&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Segoe UI&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; Roboto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.App&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.user-list&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;list-style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-direction&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ddd&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* User */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; relative&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; grid&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;grid-template-columns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;fr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;fr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;fr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;align-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fadeOut &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;ms&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; forwards ease-in&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.user&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:hover&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.attr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; bold&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#aaa&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.attr&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:hover&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Form */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.form-add-user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;align-items&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; wrap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Input */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.input-custom&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Buttons */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.btn-custom&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pointer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ffd700&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#d8b72f&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.btn-delete&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;-20&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.btn-custom&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:hover&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ffd700&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#333&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;transparent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.btn-custom&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:disabled&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; not-allowed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#888&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.btn-custom&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:disabled&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:hover&lt;/span&gt;&lt;span class=&quot;token selector punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.btn-custom&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:disabled&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:active&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#888&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ccc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token atrule rule&quot;&gt;@keyframes&lt;/span&gt;&lt;span class=&quot;token atrule&quot;&gt; fadeOut&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React + Node.js]: Create your MERN Stack Application - Part 1: Backend]]></title><description><![CDATA[Overview Demo This post will show you how to create a MERN (MongoDB, Express.js, React, Node.js) Stack Application from the scratch to the…]]></description><link>https://ellismin.com/2020/03/mern-1/</link><guid isPermaLink="false">https://ellismin.com/2020/03/mern-1/</guid><pubDate>Thu, 12 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;overview&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#overview&quot; aria-label=&quot;overview permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Overview&lt;/h2&gt;&lt;p&gt;&lt;a href=&quot;https://mern-demo-prod.herokuapp.com/&quot;&gt;Demo&lt;/a&gt;&lt;/p&gt;&lt;p&gt;This post will show you how to create a MERN (MongoDB, Express.js, React, Node.js) Stack Application from the scratch to the end. Part 1 will focus on &lt;strong&gt;the server side with REST API.&lt;/strong&gt; Client side will be covered in the upcoming post, &lt;a href=&quot;/2020/03/mern-2&quot;&gt;Part 2&lt;/a&gt;. This app will involve a basic CR&lt;del&gt;U&lt;/del&gt;D (Create, Read, &lt;del&gt;Update&lt;/del&gt;, Delete) operations along with simple layout in React.&lt;/p&gt;&lt;p&gt;The full project is available on this &lt;a href=&quot;https://github.com/EllisMin/MERN-demo&quot;&gt;repo&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;//opt/buildhome/repo/_posts/e9ab17964c64899a6eee3db4b94450b6/overview.gif&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;mongodb&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#mongodb&quot; aria-label=&quot;mongodb permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MongoDB&lt;/h2&gt;&lt;p&gt;Let&amp;#x27;s start off with setting the database cluster with MongoDB. If you haven&amp;#x27;t, go to &lt;a href=&quot;https://www.mongodb.com/&quot;&gt;MongoDB&lt;/a&gt; to sign up &amp;amp; sign in. Then, create a free, &lt;code&gt;Starter Clusters&lt;/code&gt; with default settings.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:273px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:74.88372093023256%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAABq0lEQVQ4y51SyVLCQBDl/z/AmxcVSMSCJKABLpQKXPSgB61yQSwg7CQkJhII4Tk9RYIJLhRd9Wp6ef2mZ0kUCgXk83nQGvd3AfGDnmw2hwQF6sU5Dg6PcMYSgijiOJlEKi1APM3gJJXmuZQgIC2IEDMZ7hOyuVxkiFCQAklWwt1kWYaiKHzd+EroBzVl3RsR3OeY/x55X7H4vUcmlCRpb0QE6S4qlQq63S40TYugE4LVWL0Tq1NPu92GqqpclB4pQTvU63X8Zpahw5yMYOoTFq1+5JTLZf5QoWCtVsNqtYLv+yGoeeh4uO07uO3ZuOvbaBguzwcc6vE8D6VSaVuQjAgByDTbw83AhdJ0UOvNcD92ed7/xlkul7sJBg2BxWtB3ftLMG7b4tsb+Usf5dIPdzhd2Bi7JsfEtTCd27AWDkwG8gnkU06ff3CePrcwcHSoxeLmlWVJxmX1CgYjBbbwPTTMDt6sLp6nLYxmBnrOGK8s98Rie/EZcvWZhbzKPvj3b3NdraI/09lkJseQCbyw5kfjHQ9GEw1LwyvDwzrWnBE/BU3asgYoqBeh4Bfw3gdIvmo3ggAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/4615539b3fb05e32d263ddf5c5687c89/0217c/5.png&quot; srcSet=&quot;/static/4615539b3fb05e32d263ddf5c5687c89/2eb24/5.png 215w,/static/4615539b3fb05e32d263ddf5c5687c89/0217c/5.png 273w&quot; sizes=&quot;(max-width: 273px) 100vw, 273px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:72.55813953488372%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAACNUlEQVQ4y31UDW/TMBDd//9HSLBua6HQDrFKG0JiVKNbP9I0iePEsR0nfdzZaZuOgaWnnL/u3r0758JYizjdIUoTbHYxou0WaZaBx36/x3F0tqwVEpN7pEZ66MbCuQZFqXBRGYNYCzw+PeIlWUO6CkoWkFnOXrCSBmnlYOkCB+ij3beEEKhpeg4TKxEnC8RFRA4N6qpAJYU/+CwMFsJC2Qb/G+7gkFMWuUBGrFIhUBYlRaPI7R7W1hTaedS1JdSonaP0XLA7cCZHhtpYfJ3NMPo8xtVoiHeXHzCg7/2P75hMpxhc3+DqZojr4Qj3Dw+YfbvD+8sBzYd+b/Rp7IO0bRscKkp5nq6wIP2esw2WIsLvfIOdzmAqBaVI06ryTFg3R3NZkCRao6J1Td8zDTWlJejAliqdllQ9mUE5qlqtoUsJQ/shRecv5kWMki6ys4ZYvalhaAucfaNoizuSYnJ7iy+TKT6Ox/g1n/s9Tq9f7VcO67OeO/jNCo2fT0us1yusVmu8LJfErPyrP/ev20aThrzGG1xdblDXifzW4OqHHgzwNp21pPGxyoLaJUlTsHPePICjhuqVdCZHLiXyPD/ZBH5VXDiudHCoDRhe5KbxbD3LpvFfXqsqjVJ1FVehsuGepgDS79UHhoYYZhRllyTYxjHZIqTTY3r2IoiJIJaSHoIiR2wbyuzEkCaMQ19xzwUd+3AdGv962JHqepDvMjtePzpk/fgvkwlxbIt/oldhnnsNq5OGfwAC1IZrklo1bwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;12&quot; title=&quot;12&quot; src=&quot;/static/e424caa4bca750dec0cddd43a6ef3d77/914ae/12.png&quot; srcSet=&quot;/static/e424caa4bca750dec0cddd43a6ef3d77/2eb24/12.png 215w,/static/e424caa4bca750dec0cddd43a6ef3d77/05ed2/12.png 430w,/static/e424caa4bca750dec0cddd43a6ef3d77/914ae/12.png 860w,/static/e424caa4bca750dec0cddd43a6ef3d77/d1d24/12.png 987w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Once your cluster is created, press &lt;code&gt;CONNECT&lt;/code&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:322px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:39.06976744186047%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABT0lEQVQoz5WSv0/CQBTH+fdcHJ1MdHNTJwdDYoya+GOoCLRLUUpte71eaekPJHGRBEZWZUNkscBW9q93FzBxq8Mn9/Leve99392VkiTB8XUVe+VbHJwr2D29wWVNR6+bohNFiOP4X5Qi3rRfvsP20QV2Tq6wdXiGsqLhtddF2OlA1IsiDJTSOAFLPCimAdUIoJk+Kk8MTRLghbuMeV1MUQTpMOENpE2h289oOT4eLQ+6SUE8H+l6UxGEYLQZOQxCuLYDQmwwzwWjLtq+X9jZBikYhiFGoxE+p1NMJpNf3vp9iJo4/c9drR1F6wfbrFJQ3GEQBPiazTBfLPAxHuOds1gu0eeCyn0FtboqMVot6I2GjOuqClXT8FCtoWkYoJTCIUQakILCUZ7nyLI5vrMM+WqFwXAoRRyHwLZtUM8DcV1YPBaIvGVZMs8Yk6LiV/wAJ5DpqV1QzVoAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/025205bb74b986f7a9ff35e91a8209ef/fc778/6.png&quot; srcSet=&quot;/static/025205bb74b986f7a9ff35e91a8209ef/2eb24/6.png 215w,/static/025205bb74b986f7a9ff35e91a8209ef/fc778/6.png 322w&quot; sizes=&quot;(max-width: 322px) 100vw, 322px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Add your auto-filled IP address to whitelist and create a DB username &amp;amp; password
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:659px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:44.651162790697676%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABXklEQVQoz32STU7DMBCFczbWII7CsmLHSVhwARaAxB4JxI4fUXVVmjSk5D+t7Tix4zxsx21JJZjoS97Y1vjFY+/l9Q3LMEQcx6iqCkmSIM0y5HmOaLUCYwwm+r7foRzbfDtvwqs5x5pukKQp0jRzxQpLFK3sJlQXpZSCaOpaa8ZRMmGRnRpt6BFCIIWA6jpIKSDEQN8PC91q8xo52g0fhDedzbDUTpZfKwRhhEUQWl2tCVrRodG0QlltzBhHUkp02oCQZl5ZzLh1aKp2TQJW+KBFAF754OWn1gtsch8sn4Nkc7AyRF0FmhCMEnB9VLRuUDGJDZegjRwKKqW37Vrt3yAA1Wj4oCH34710XzH8vnv2WulGqcHh9jwscPzOD/R/4ZkGtG07uhZ/oVyjfBLj4fsdj/GH5SmZ2nxa+vCKskReFKPu/RWdK3g1u8fR9RlObic4vpng9O7c5hfPl/gB2bmz5/q8tNMAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;7&quot; title=&quot;7&quot; src=&quot;/static/d29b340c7556d691d3f0448fcf4d0e57/6db71/7.png&quot; srcSet=&quot;/static/d29b340c7556d691d3f0448fcf4d0e57/2eb24/7.png 215w,/static/d29b340c7556d691d3f0448fcf4d0e57/05ed2/7.png 430w,/static/d29b340c7556d691d3f0448fcf4d0e57/6db71/7.png 659w&quot; sizes=&quot;(max-width: 659px) 100vw, 659px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Choose a connection method as &lt;code&gt;MongoDB Compass&lt;/code&gt;. Then follow the instructions to install &lt;code&gt;MongoDB Compass&lt;/code&gt; on your system
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:666px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:64.18604651162791%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB7ElEQVQ4y42SSW/bMBCF9bcL9FygP6C9GC28SSQlkaLkBWh7z8XoxUt7aOsNTQ5NvKTykoORlxnWFuTAAUrgwxtR0nDeDD3bSlHXAXyj0DACTSMdSWYhhYCUAkpJBEGAgJ5ZrbWIoshpu91Gq9VycOxpraGiELH5p5GOEbLGmvasI2K0RZplyAj++aTP8YJAwKdTpVRoNn0IqsL3fTRpX8YJZGQgGIptmrpEXMlLeIlJkNkUxhhHkiQFOo6hqeKY7GlXeYSYHF2qrKgwshoVVaNkCWJKwEQl0jQr+uS0fTlRdmyD91E18Or9G2p8iEajSbYJsswxI5VyA4ipp9xvhmOGHZ2sZsf+et12B5+7n9xmt9tFp9NxypQ//C/cUEyId+IDjDYIw9DZVFQVDymlIZSvRUGpBSeKHlZEFa8rbxGS5Vq9jgZZrlarqNVqlFS6Q7gdfAjfACFOe8rZTlPr7iMPkdW7nv3G6uYW09kU8/n8jOl0WjApx5PJGePxGLPZDKPRCN6fhzW+XH/FZrPF+v4eq/Uai8USt3d3WCyX7vlwOOC0Hh/x4lqtVvButgu0fl5hv39Avtkgz3Onf4+a5xvsdnvs9ntstzun5QPKa0kFeN+GI/z6/gODwQDD4fAi/O45/X7/DP6u1+vhCUPmSkqm7otaAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;8&quot; title=&quot;8&quot; src=&quot;/static/b77c43c64398c307489e88859dd7303d/ace37/8.png&quot; srcSet=&quot;/static/b77c43c64398c307489e88859dd7303d/2eb24/8.png 215w,/static/b77c43c64398c307489e88859dd7303d/05ed2/8.png 430w,/static/b77c43c64398c307489e88859dd7303d/ace37/8.png 666w&quot; sizes=&quot;(max-width: 666px) 100vw, 666px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Copy the string&lt;/strong&gt; that will be used to connect to database in your back-end and in MongoDB Compass
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:659px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:57.20930232558139%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAABkUlEQVQoz31Si46cMAzk/z+uVVu1t9dreYTjgA0kIbwCbHdqW8uVXbW1NDgoZjxjE7nQo+g1cl9DESR3FaqhhZ4c+L6be7jJw1G2lPswYls3jOOIy+UCjuv1KoieTIpTmeBL/h2f1TM+xF/xMfmGT9kJTzoRQm876LMWNLqBac070U62R9TPI/w8YFxmwRCmu3NYF2zb9gdExGS7op3sXeHLyw8olWPoB/jOwxgLZx3sLbdti/p8xllrVHUN3TSwzt2RHCPih6OChgr5Y2OMIISAYRjwr3gkuiO01kKTgpaIdlJW0XmPZVmEeJwmTISBFsHN/quQi5mISSzZFNt0ZqIQFhhq2NB9S8tgy54aHQmPiMqyEoU88GVdEUgRq2IVe2Zl403Zcbt/tcwDL95KGTqfGZWuUWvOBHp/K0tZSFlVonCeZ2nCDVkE5/0vEMts6WccI8sUVPGKUxHjmcA5VilUniNTCmmWSV2SpoiTRObOQl6LQu6ZJ/pFvsXazeryYPl491izkrqe5szL4/nzwn4D4P5Ob7g8rdIAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;10&quot; title=&quot;10&quot; src=&quot;/static/9ed64c3c4b46234c5cb0e7964cdbce90/6db71/10.png&quot; srcSet=&quot;/static/9ed64c3c4b46234c5cb0e7964cdbce90/2eb24/10.png 215w,/static/9ed64c3c4b46234c5cb0e7964cdbce90/05ed2/10.png 430w,/static/9ed64c3c4b46234c5cb0e7964cdbce90/6db71/10.png 659w&quot; sizes=&quot;(max-width: 659px) 100vw, 659px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Once installed, connect to MongoDB Compass
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:619px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:38.13953488372093%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABJElEQVQoz6WRTW6DMBCFOWZ7m/YSvUbXOUOXXVQlgSgNCQHCj41/wDa8ekyDou6qWvr05g1jeWaI4niLw9cRSZIGtrsEddMiO1/wuUtxPOWQSkNItaK0DlBe3UE+6hhHLyRICcb74AnWC3CvQi7FzMeHogukeYs9cWlDHGc1ioYjctME5yZM87xA3mOthTHGq4N1LvhbPNoF8wulB99h26IqS7Q/WlUV6muNsigCTdMgP+dgjPmHHe7P7BuYZ2pmCn4cDSLqgoqJvu9XOOdBKU/xjdX7bxM9MGNlGEY/srMQQkBKCU3LVipAOVLK33IUr7V+p9oMuGqGSnUQRi0d4h/nrfjA4+YZD5snvLy/An7yyK0L/xt0Tw4aJ1Yi6/w/UDyM/A1R/2fSxAIJBQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;9&quot; title=&quot;9&quot; src=&quot;/static/4f55089078e901adb0869c7abe55c225/e628c/9.png&quot; srcSet=&quot;/static/4f55089078e901adb0869c7abe55c225/2eb24/9.png 215w,/static/4f55089078e901adb0869c7abe55c225/05ed2/9.png 430w,/static/4f55089078e901adb0869c7abe55c225/e628c/9.png 619w&quot; sizes=&quot;(max-width: 619px) 100vw, 619px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;This is where you can visually see &amp;amp; manage data that we haven&amp;#x27;t created yet. Leave this behind for now and continue to the next step.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:603px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:48.83720930232558%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB0ElEQVQoz3WS2U7bQBiF/TosFVvLFgiQhD3O5mylkFxwAYKH4AWqcs1V36CvABISUiSkpi0QQiIFCaQkQFvisccksX2YGWQrKcXSJ3sszTfn/Lbki2cxGIigdybo0jcbRI93FQP+CPIXBZCmjstKCdfVG5AWhWlZIIQIKKWw2NpB8ikb8Ccy8Mhp+OMZBJJZsZ4IJhHL7ODg6Bu2j79g92gfW4efsZf7ir9qA6pK8NhQBQ32rDK5puuQJtnGD4tRjK8oGFtW4I2sYSa6Bk8ohflEFif57/h1W0Ku+AOn5TP8rBSFRCVaF/xdrVaHNB5MYXghipFFhRFD/6yMd3My+lj1ofkozgoltOgT7qp1PNz9xn39QSTSqeFCDQNE01HlwunwRwRYkonVBMZW4hhdUjDKkr5n8kl22PnlFdoAHmkLzmXZdtfcOKZpinlKXKZs7oLPciqUFpU50+E0fPENFK7KMG1A1Z9eSRxsdkCXUM5sCQkXcnhqj5zCXGwdF0xosVR/iCE2Wv9i2a5Q0zRILx/hkyt6JSyWRc2G9nZCp7LBZil1pnLunUJeucUiEtpk2pc0/4ML+X8pOYJOmStU1nFeLInKutEUm96i3W6LGT4DbkdgFmtvddgAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;11&quot; title=&quot;11&quot; src=&quot;/static/ce39eafc5401771bce5663b779fdfe84/9128f/11.png&quot; srcSet=&quot;/static/ce39eafc5401771bce5663b779fdfe84/2eb24/11.png 215w,/static/ce39eafc5401771bce5663b779fdfe84/05ed2/11.png 430w,/static/ce39eafc5401771bce5663b779fdfe84/9128f/11.png 603w&quot; sizes=&quot;(max-width: 603px) 100vw, 603px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;nodejs--express&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#nodejs--express&quot; aria-label=&quot;nodejs  express permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Node.js &amp;amp; Express&lt;/h2&gt;&lt;h3 id=&quot;packagejson&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#packagejson&quot; aria-label=&quot;packagejson permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;package.json&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;textile&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-textile&quot;&gt;TEXTILE&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-textile&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern-demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── package.json &lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;First, create a folder where you would like to contain your MERN stack application. Here, I&amp;#x27;ll create a folder &lt;code&gt;mern-demo&lt;/code&gt;. Then, browse over to the created folder and create &lt;code&gt;package.json&lt;/code&gt; with &lt;code&gt;npm init -y&lt;/code&gt; command. Make sure that &lt;code&gt;package.json&lt;/code&gt; was created and run the following commands to install required node packages.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i express mongoose concurrently&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;concurrently&lt;/code&gt; allows to run multiple commands concurrently. It&amp;#x27;ll be used to run back-end and front-end server at the same time&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;If you have not yet installed &lt;code&gt;nodemon&lt;/code&gt;, install it as dev dependency.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i -D nodemon&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;nodemon&lt;/code&gt; continuously watches the changes in files so that you wouldn&amp;#x27;t have to restart the server every time you make changes. You can choose to install it globally with &lt;code&gt;sudo npm i -g nodemon&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;With those packages installed, modify &lt;code&gt;&amp;quot;scripts&amp;quot;&lt;/code&gt; in &lt;code&gt;package.json&lt;/code&gt; to start developing.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;diff&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-diff&quot;&gt;DIFF&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-diff&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&amp;quot;scripts&amp;quot;: {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token deleted-sign deleted prefix deleted&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token deleted-sign deleted line&quot;&gt;    &amp;quot;test&amp;quot;: &amp;quot;echo \&amp;quot;Error: no test specified\&amp;quot; &amp;amp;&amp;amp; exit 1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token deleted-sign deleted line&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token inserted-sign inserted prefix inserted&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token inserted-sign inserted line&quot;&gt;    &amp;quot;start&amp;quot;: &amp;quot;node app.js&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token inserted-sign inserted line&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token inserted-sign inserted prefix inserted&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token inserted-sign inserted line&quot;&gt;    &amp;quot;server&amp;quot;: &amp;quot;nodemon app.js&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token inserted-sign inserted line&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;},&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;configjs--appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#configjs--appjs&quot; aria-label=&quot;configjs  appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;config.js &amp;amp; app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;textile&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-textile&quot;&gt;TEXTILE&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-textile&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern-demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── app.js &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── config.js &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── package.json&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create &lt;code&gt;config.js&lt;/code&gt; that will contain your MongoDB URI that you&amp;#x27;ve copied&lt;/p&gt;&lt;p&gt;&lt;strong&gt;config.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;mongodb+srv://&amp;lt;DB_USERNAME&amp;gt;:&amp;lt;PASSWORD&amp;gt;@cluster0-xc4db.mongodb.net/test&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then create &lt;code&gt;app.js&lt;/code&gt;. This is the main server that will listen to the request from the client side&lt;/p&gt;&lt;p&gt;&lt;strong&gt;app.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mongoose&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./config&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set CORS header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-control-Allow-Origin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Methods&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;GET, POST, DELETE&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Allow client to set headers with Content-Type&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Headers&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Error Handler&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; status &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Passing original error data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// DB connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mongoose&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useNewUrlParser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useUnifiedTopology&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useFindAndModify&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Listening on port &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;At this point, when you run &lt;code&gt;npm server&lt;/code&gt;, the server will start listening to port 8080&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;user-schema&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#user-schema&quot; aria-label=&quot;user schema permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;User Schema&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;textile&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-textile&quot;&gt;TEXTILE&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-textile&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern-demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── models &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  |     └── user.js &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── app.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── config.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── package.json&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mongoose&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access maybe-class-name&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userSchema &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Schema&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;unemployed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;timestamps&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;User&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userSchema&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Each user will have 3 properties: name, age, occupation&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;router--controller&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#router--controller&quot; aria-label=&quot;router  controller permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Router &amp;amp; Controller&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;textile&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-textile&quot;&gt;TEXTILE&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-textile&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mern-demo&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── controllers &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  |     └── user.js &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── routes &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  |     └── user.js &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── models&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  |     └── user.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── app.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ├── config.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  └── package.json&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;routes/user.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userController &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../controllers/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access maybe-class-name&quot;&gt;Router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// GET /user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;getUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// POST /user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;postUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// DELETE /user/:userId&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/user/:userId&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userController&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;deleteUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; router&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Router here defines the 3 CR&lt;del&gt;U&lt;/del&gt;D operations&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;strong&gt;controllers/user.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../models/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;getUsers&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Fetched users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;postUser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; occupation &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; occupation &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;unemployed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; occupation&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Save in db&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;201&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;User created&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;exports&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;deleteUser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userId &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;findById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Couldn&amp;#x27;t find the user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;findByIdAndRemove&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;User removed&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;register-created-route&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#register-created-route&quot; aria-label=&quot;register created route permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Register Created Route&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;app.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mongoose &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mongoose&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./config&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userRoutes &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./routes/user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Set CORS header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-control-Allow-Origin&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Methods&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;GET, POST, DELETE&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Allow client to set headers with Content-Type&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setHeader&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Access-Control-Allow-Headers&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Register Route&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userRoutes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Error Handler&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; status &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Passing original error data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; data &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// DB connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mongoose&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;MONGODB_URI&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useNewUrlParser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useUnifiedTopology&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;useFindAndModify&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;8080&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Listening on port &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Deploy]: Deploy your App on Netlify]]></title><description><![CDATA[Deploy your static websites to Netlify]]></description><link>https://ellismin.com/2020/03/netlify-1/</link><guid isPermaLink="false">https://ellismin.com/2020/03/netlify-1/</guid><pubDate>Wed, 11 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;netlify&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#netlify&quot; aria-label=&quot;netlify permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Netlify&lt;/h2&gt;&lt;p&gt;&lt;a href=&quot;https://www.netlify.com/&quot;&gt;Netlify&lt;/a&gt; is useful when when it comes to deploying static websites. It is very easy to deploy from your github repository, supports &lt;strong&gt;custom domain&lt;/strong&gt;, and &lt;strong&gt;free SSL certificate&lt;/strong&gt; (https). Basic features of deploying website is offered at no cost, so this tutorial won&amp;#x27;t require you to purchase any add-on service. If interested, check out the &lt;a href=&quot;https://www.netlify.com/pricing/&quot;&gt;pricing&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;project-in-github&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#project-in-github&quot; aria-label=&quot;project in github permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Project in GitHub&lt;/h3&gt;&lt;p&gt;Before deploying your website, you should have your project saved in your github repository either public or private.&lt;/p&gt;&lt;p&gt;If not sure how to please check out this &lt;a href=&quot;/2020/03/git-repo&quot;&gt;post&lt;/a&gt;&lt;/p&gt;&lt;h2 id=&quot;steps-to-deploy-on-netlify&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#steps-to-deploy-on-netlify&quot; aria-label=&quot;steps to deploy on netlify permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Steps to Deploy on Netlify&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Go to &lt;a href=&quot;https://netlify.com&quot;&gt;Netlify&lt;/a&gt; and sign up for your account, then sign in&lt;/li&gt;&lt;li&gt;Once you&amp;#x27;re signed in, click &lt;code&gt;New site from Git&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:300px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:78.13953488372094%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB/ElEQVQ4y52S3UtTYRzHn+U2p7Hm2XFuoGEvprCUhkpQ6IJeILoIgkgKosAENaZz2grqH+i6qJAiFVeBc2evHjdw04vYUpyYUHf+BxFdGF5o337n2QaLDTruwIff93n48XneDtMLFvwPrUmEydqIVttRHKJsEK2wNJ9ETb0VGqOIq+db4LrRDsFmBVMj1BgFtHY40HnaAXbYBKGxGd09FyA0HYP2iICXLidWX9yCw94Epqurhxr05gZUkZxnqkbacTVfTMSZ9uO45rSjRrSAVVNjJSjiQmYkZbVmaGmuYmEBZbcGcw4lqz6yWlQ9ykFgytOXYqsIfp+syoCyaPR5dCqgPqbjvxQbco2imEGljrgx5n2iCg8x+sgL79NnsHedBVtZXkYxqWQSmXQalXwjE4/BgqEQCoQISZKwIMvY39vDj987uCNL6J2bQQ9xKeDDxXkfrgQ+wJkfXyZcSzIXDrk9YNFoFMWEw2EsxuO8YfvXT3TMTpLAhxNTr9D18R06ibaZN3yBU9Ov4fC9xblP73n/sHu8vDCRSPCG3T/78HxO4v7SAh6kZPQncyjjgdQi+mnudiKM5+u5K3o4NlEqjEQiiMViSNM9fslk8C2bLeF7diOfN3jeXF3D1tZX9N29969QkRVqMBiERMwHAhx/vpbLc34/nSqO6zf78BckzH1gJHUeqwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/4cea0a779ebae398411cb3ab449cb758/5a46d/1.png&quot; srcSet=&quot;/static/4cea0a779ebae398411cb3ab449cb758/2eb24/1.png 215w,/static/4cea0a779ebae398411cb3ab449cb758/5a46d/1.png 300w&quot; sizes=&quot;(max-width: 300px) 100vw, 300px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Then select &lt;code&gt;GitHub&lt;/code&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;It&amp;#x27;d ask you for github&amp;#x27;s permission. Grant it&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:483px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:79.06976744186048%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB+UlEQVQ4y61Ua28aMRC8//+P8qHth7YoOQq0QELC414cHPcOHNyLg+mOIVKKiESlWBrN2l7vru2xtU2WQe900dLb+HGvYzIz8Pj8gp8POkYvY7Qe2vg9GOLWphVFiZllY2pamBgm5oslHHeh+rbrwpA5jtGvLCuUVaW4Ei7KUnFeFNjudmiaBlqzb1Bst6hlQZUXYu+QS38vztvNRpAhz7ZY+QGiOEEQRsIxoiRBGMWIk1Q4gitJS1mjFfs9xkmkMFGIFcZxBGP9KkhhCleS/XA4/IPLdjgeoZV1jaFl4c9shkfhvmEosB9IpXGRK2SyJVazlqpDqZDMoEcJ8sbcvoZPbhojN5LhPQ5X7Lcq3oPtcuy/KrxcfA0ar3s4esaTaI66m4p0iF5/gMHTSNmcm5rmbVuu5FLsuau05whbzhzeyodpOyqY5TjK9nwfe1FELf7UG21yzTEB++pS6OAuPSwliB+G8IMQC2+lglJ7hHee4zgT0pfsLpdn9jDnY5ACNEamQClaCpQBKIv4LFwmSNJXNX8S8UnUBEW+CgIl9CRNlc/ny6bcBTCmXVhmH6ZwvlmoTDw3ni0vjVXyw1DnLGClH926tlvb0PUv6HS+o9W6wzqeqHPRu6cfiMH5A919/YZ2r4f7Xx2V6MOAOPJNlmcU0q1v1uS19hf4f8oMHdut4AAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/74d2a34b293c55cc383e38e21c003b22/77a9e/2.png&quot; srcSet=&quot;/static/74d2a34b293c55cc383e38e21c003b22/2eb24/2.png 215w,/static/74d2a34b293c55cc383e38e21c003b22/05ed2/2.png 430w,/static/74d2a34b293c55cc383e38e21c003b22/77a9e/2.png 483w&quot; sizes=&quot;(max-width: 483px) 100vw, 483px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Click &lt;code&gt;Configure the Netlify app on Github&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:577px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:81.86046511627907%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAAsTAAALEwEAmpwYAAACAUlEQVQ4y5VTS4/TQAyeH4/EAQnBhe1zm1ebSdJHkqbtpafeyrbqEe2lEgiEENKKNqEpW6Rv7UmnChELu5E+2WN7HH+2R0jpodFsodluo06ydd3BVb2OWqNJ5yY6hoE22VRMq413tRr4zmQyQRzHCuPx+AIxGAxgWjYs24HtdEm3lOz2enC6Gnx2lW47jvJddwxYpLOv57rKzxCD4RCuKwtICc/zlXSpCul58PzizHqPYjhpYSt8SZL8AcGlT6dThdlZsq0cNNGS7NqnbUyz8BV+4dg2Xr18QX1r4PWbt2i0WqovSakvjyGOx+j3+4pywUpCxFGMwPfA1IOgjyHJaqP/hSiK1F2eBUO4lN2j/oRh4QgpoEzlKdCtKCjTpEzThE/VWUSfy09K/aniMftlbQxKxpA0MZtWQE+unKB65paMwlCxqULwHtlUWUD8u1SdHwT/pRhTYr4clXBJyHQNeg2S9s8wLbW0Tx3I39oheCCSxq2nxX+ZzWbPBg9E9fCy2Oe3ud1ukec5fux2SPd7Qoo9SUaWpkgJO/JpG+tZlmG5XNKmhBC8d/ppcT8/3N7idPqNu2OOj4cMX48HfPuV4xPpX/IDvt8f8Tn/ibvTPcrfZrPBaDSCqC7pYrHAer3GzWqF96sbBdb1WesMjlud5Xw+VwxFdYKclP/0XKjnSvcfAAWi5/VgEOiTAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/fd0bbacb711e1b26b8a3eac92fbc6af5/065e2/3.png&quot; srcSet=&quot;/static/fd0bbacb711e1b26b8a3eac92fbc6af5/2eb24/3.png 215w,/static/fd0bbacb711e1b26b8a3eac92fbc6af5/05ed2/3.png 430w,/static/fd0bbacb711e1b26b8a3eac92fbc6af5/065e2/3.png 577w&quot; sizes=&quot;(max-width: 577px) 100vw, 577px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;This may open a new tab. Scroll down to &lt;code&gt;Select repositories&lt;/code&gt; and select your repository &amp;amp; click &lt;code&gt;Save&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:514px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:93.02325581395348%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAATCAYAAACQjC21AAAACXBIWXMAAAsTAAALEwEAmpwYAAACOklEQVQ4y52U2W/aQBDG/T/3NW/tU9NKTdIYGhKucBgcbIy5xHObgmikvvRCtI0opwpYGGxDAvo6u2DaqA2BWvr5G69XszOzOyvsP3uOl8ciDg4OIYoenJz4cCyKODw6gizLyOVy0HUd2Wx2KwRFUaEoClQ1jRSpoqrcVkk1LYNMRicyWyMwr/l8HoVCAcVikSv7dldk0e2CwLyy1CKRCKLRKFdZvuCpbpvmnZTZK5FIwON9BdHjhc93imAwhGRShkTjcUlaalxCNBYHK5Eb+T8darxGyzppmsYnptPpVV1VPqat/jHYvE2lEIJSFuJZHKGgH35/AOHwOVfX3rmGup5B9d0VLstVvHlbQaV6hdeXZaKCMtnfrxuYOjZsy4Jt349Dc3q9HgSW3qcvNbR6BurXLXxrdLm6dm9gwp7NYU03M7tdwDRN2mVNxfuPX1FvGTAmtzCnwIjg6gCGtcBgMt/IkGj0p+j3+7QpFOGHz3V0hg6G4xuM7AXHsOacIS2ymRuuP0czDAaDZcq1Wg0jc4xmq40fRLPdQZ9+tjpdTKcU6paPYRgQ2NGo1+tUWAftTgeNZou0i/F4AnM8hsU3w96I4ziw7NWmuAfUPYPLntTX7cj0IXTevgWUSiVySB8symgsRh0SRIBgZ5CN/V7gftici1RqfejXEf7Zu//bx8te1snQl63EwmfOdrmu/rq+Hnn3sHf6GOdSjC6GMwRC4Tv9unOETwL7eBp+AUlOIhKNIUa3ykMXwCZ+AaHy3ewxtHB1AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/8bdbf1248069d6dd10899d40792a8d24/dea13/4.png&quot; srcSet=&quot;/static/8bdbf1248069d6dd10899d40792a8d24/2eb24/4.png 215w,/static/8bdbf1248069d6dd10899d40792a8d24/05ed2/4.png 430w,/static/8bdbf1248069d6dd10899d40792a8d24/dea13/4.png 514w&quot; sizes=&quot;(max-width: 514px) 100vw, 514px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Select added repository&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:523px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:68.83720930232559%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAABl0lEQVQ4y42TWU8CQQzH51MbX/wCEJUH4xGCxsQ9kL05PgLyQMIRQd9I4ElOE3zh/NuWlSwbEDb5pZ2ZttN2O8q2cnBdF7bjCL4foFAoIJ/PizwG2wVBILCuLs7PcHd7g8TlFZJEOpOhoP7W+BhsZ9k2XjQNmm5AlUolFIvFLadkFYV9/rL0CZWhjGy6wbIsOFQyl7+PQ2eOtMnfXqACWrxVKqhWq6jVaqjX63tpNptoNBo7e2zPe+VyWTKUgOPRCMvlEse+6fQH8/lc9PV6LaxWK1l3u12p0PM8qFarhcFwiMVicTDYkhzfPz7FjoNwYGY2m8l5p9NBLreZFtXr9fDV72NIxiPKlmUc3v+eTEgOMRgMtvTJbzweo91uS3YyNqnUNXJhutGZ2sex8ZEe6roOj37Mf4PMZ/wnT0ElkklohgGH6g/YMZynOC5VcAqqSIOdP+FVFEKia2lRDLWTMmcT6l7gw2X8iAx1j+wcfyPj7VGGacI0s/ION1KHTi14zpq4N3Q8EBnS06Yha5aPr1nZfyIZf/O/nyqHz52GNoYAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/c1bbec17959dad009f004b5a06b174ee/3e286/5.png&quot; srcSet=&quot;/static/c1bbec17959dad009f004b5a06b174ee/2eb24/5.png 215w,/static/c1bbec17959dad009f004b5a06b174ee/05ed2/5.png 430w,/static/c1bbec17959dad009f004b5a06b174ee/3e286/5.png 523w&quot; sizes=&quot;(max-width: 523px) 100vw, 523px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Specify build command &amp;amp; publish directory. Then click &lt;code&gt;Deploy site&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:691px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:96.74418604651162%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAATCAYAAACQjC21AAAACXBIWXMAAAsTAAALEwEAmpwYAAABxklEQVQ4y6VUWXaCQBCcO+UYOUOulu/k188cI4kbCnFB1ETZB2SRSvcoRA2gL+n36jU0Q00vNSOGozH62ggj3UB3MIQ21qHR82u3p97fun3ljclUfev2BxgbH9A/JjCmU/SGGmbmAmxFUUDIKEIQhgiC8OCP8IMAnh8o75N3PQ+hlAqH74d1HM/z/IeQg/v9Hv8xJmKwiY1tYzKbw7SWsB1HBXlH3uQSu90O+XHzkuSUTGW4SxLEtJBL4Z8uF9ahlXBrO6qp3C8OqGzYn+K4UZZlVXtKkksTaZrCcd2zYF25DF57rQrBU+JJ2o4Lzpb9f0xYlgVrYcGkss25iQU9S+ony4IlJWWEMJTqWUmG4zKq5KXi4UFOCVUgPim49D1Ynou5Y2NB5X8Ryh9LopK8llCeEK6JbBX42EQSbppgG0dIi7/rUthbGzPS4Wq5QkYSUhNsGEqlRdJp41A45S0JmsF6rKTTgGvSERvK0KTB8KTbJHNOWDQTcmPXn1/Vrr9EfUSZeUJtac2QJ8PHL4pj1Z9bjl3rSTHoXnvv9RU0XT87l9dultoM4zxDSFlG5OsOfdvlUJvhw0sHd0+PuO88w6WS2xbfYt98V8qsMx4R6gAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/c713464eae0870fb767d7ba23aa8c94b/e185b/6.png&quot; srcSet=&quot;/static/c713464eae0870fb767d7ba23aa8c94b/2eb24/6.png 215w,/static/c713464eae0870fb767d7ba23aa8c94b/05ed2/6.png 430w,/static/c713464eae0870fb767d7ba23aa8c94b/e185b/6.png 691w&quot; sizes=&quot;(max-width: 691px) 100vw, 691px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;It may take a few minutes to be deployed and will be available at the following URL&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:573px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:39.53488372093024%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABd0lEQVQoz4VQ22rCUBDM/0MvUvClWN8LFvEXClZrjEk0MUrVmkRz0VwsXnKfbk6r9EHowrBz5izD7HIDeQiG4QjiSLl0SVEZLyHQf1+SWRfO8/LvH+n8QERPGOCdwPlBgLGqQdMmcB0XpmFC1w3MZnPYlg19qUNVxvja7XCt3jod3NzfoVav4/GpBi48HiFbK6i2BYl6yTXHhrQyobkOA2/qmHobfIQ+5mGAfRwjzzJm2Gy1cFupUEIBr+02uN1+j0/HgRX4MLdbGJsNHErtUqKVR2/XhU6aTdrCtrH2PORFgTzPmeFLs4mHahULXYc0GoFLkgRxFCFLU+Rpxnh0ilBkOfGY8SxJkdLc8XBEQunKOhv2eB7PjQYEUUS31wNnUbpuX4BCN+yLEozVGi4l7fB9yKoKdTJl+tIwLncrzr0oLloZrAS3p5XXtMpm67HuhyEOlKTkDq160WllcmAm13AuLqbjludNScwICa3yV2M6fvQTJfgP3wI/UOzhxB05AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;7&quot; title=&quot;7&quot; src=&quot;/static/aceeb78ee0c08f67496fbd32bc8ea515/3c024/7.png&quot; srcSet=&quot;/static/aceeb78ee0c08f67496fbd32bc8ea515/2eb24/7.png 215w,/static/aceeb78ee0c08f67496fbd32bc8ea515/05ed2/7.png 430w,/static/aceeb78ee0c08f67496fbd32bc8ea515/3c024/7.png 573w&quot; sizes=&quot;(max-width: 573px) 100vw, 573px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;choosing-different-sub-domain&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#choosing-different-sub-domain&quot; aria-label=&quot;choosing different sub domain permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Choosing different sub domain&lt;/h3&gt;&lt;p&gt;When you click &lt;code&gt;Domain settings&lt;/code&gt; then click &lt;code&gt;Options&lt;/code&gt; under &lt;code&gt;Custom domains&lt;/code&gt;, you can choose a different &lt;code&gt;*.netlify.com&lt;/code&gt; at no cost.&lt;/p&gt;&lt;h3 id=&quot;custom-domain&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#custom-domain&quot; aria-label=&quot;custom domain permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Custom domain&lt;/h3&gt;&lt;p&gt;If you already have your custom domain (non-&lt;code&gt;*.netlify.com&lt;/code&gt;), you can continue with the following steps to link it with your deployed app on Netlify&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:26.976744186046513%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAuUlEQVQY021PAQ6CMBDj/680igzUKGPguLuxejvQSMIlzZp17a7VpW1xul7R3O+YUzqAgPSkjR9p86afnUOVcwYUScRgk7GbKAxWw9EQEfKyrLYlo/oKomExxt/D/IeeZgSm3T9lkUUxTZOFyvZhlZS8eo9Gq9eNQ6fVidi2JmY436N+PXFRdN6DeW0RxhFtd4NrO/PeHg/VeA18v6OF+mFACKMJZYOiFT7YfTAukkz7Niq+3g+bJvgArTWGgmsE5RoAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;8&quot; title=&quot;8&quot; src=&quot;/static/2486963829ee0355aae2738ca5c4cbdd/914ae/8.png&quot; srcSet=&quot;/static/2486963829ee0355aae2738ca5c4cbdd/2eb24/8.png 215w,/static/2486963829ee0355aae2738ca5c4cbdd/05ed2/8.png 430w,/static/2486963829ee0355aae2738ca5c4cbdd/914ae/8.png 860w,/static/2486963829ee0355aae2738ca5c4cbdd/1d553/8.png 1159w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Git]: Save your Project in Github Repository]]></title><description><![CDATA[1. Go to  GitHub  website Sign up for an account if you haven't already 2. Create Repository After logging in, go to your profile on top…]]></description><link>https://ellismin.com/2020/03/git-repo/</link><guid isPermaLink="false">https://ellismin.com/2020/03/git-repo/</guid><pubDate>Tue, 10 Mar 2020 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;1-go-to-github-website&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-go-to-github-website&quot; aria-label=&quot;1 go to github website permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Go to &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt; website&lt;/h3&gt;&lt;p&gt;Sign up for an account if you haven&amp;#x27;t already&lt;/p&gt;&lt;h3 id=&quot;2-create-repository&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-create-repository&quot; aria-label=&quot;2 create repository permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Create Repository&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;After logging in, go to your profile on top-right corner&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:210px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:101.9047619047619%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAADzklEQVQ4y41Ta0xcRRS+f/3hH1u1NLwf7vK0tE3AYlqj0VRTFRNMNFF/2KS10WjSoAQKBUSjNVZjNP4y2tQYNU00hBZtikAp5Sl0ofLYy8Iuu+taYHfv7r17997d+/icmd3LUrHRSb6cme+c+eacmTNccWkl7oQiewUDnWcXlCC/pIzN80tKUWgr3/QV2qtQYEvFcxZpbd4KS5gKHD7yLPbW1CH/gTLsq30YpZXVKLJVoLx6P46+Uo+DNQ+igAhz1qaSsirYKvZsg52AZtPdcxFHj51AXrEdr73xJp565jlU7auBvXIv2k++juMvHEZ17aGUIBWjWezcnfuvuJcgp8iGXbmF2LErBzuzcnDP/dnM0rWtfD/s5XtwX3Y+OHpiVl4RDhx6FK3t7+LU6Q6cauvYYjvRQmxTSxuaW9vRRmJScZ043dmFxqZm/HjhAn7u7sGR+gZwvZev4Kfui5icmsb/Hbqu32at4f8zAI5OTAI5rjBy+PoIen/5FYNXh3D5Sh9GRscwN7+A8YlJTP4+hZ5Lvfju+x+YPXf+WwwNX0dMltneuKKAkxQVghRDSIjAMAwCE5FIFArhk0mNZaHrBhKJJJKaxmI0TSe+JOMtPx0i0eES/ijinjCi/hB0kwSny6DCqQ0pzrJU7LZ1mjNNE1JEIiWLpOBwEmpQgmGmRFQ1wTKga41lZbINW0eqGiOdsca42HoE3MTAKPp7+uB1uhlJS+sbHMIi72LrwF+3MDu3ALfHiwUnj5tkvuJe/ccjpUqWqKBrehHzYzNY9wQYqREnv+zG+kYwfdEqpJjMHi0qSogQ0LuyrkMnGdK73hT8Y9QBqIASFNPvnSnNNI079w71pWEaRqbkyOoGZL+AoG8dckKHpGgEScSIlVWdWTGuMV5WM4gTnwW6VjQToUCYlOzg4XPM4cy5cew4uYTiliXkNfHIfodHblMK9lYX47MandjdyG9Dzts87n6Lx7EvnOBmRhxYmZxGx1cT4BpmUPveMuo/X0UNsXUfruCJsx40fOnFq1/7cdeJeXAvzoJ7ieJmBi8TPD+Lp9+fA7fmCkB0+3H+0iKqu5Zx8GMvHv/Uh8c+8eLJz6j14ZGzPsZRW/eRl8T4cOCMBw99sELgZgdXdbnR/I2L9GEwAfNWHOqGyC5WCIfITxEgk+8kSiKbi9EoBEEgvjAkMYpQcANaMrHtneKCCE4OyYiuRRFeCzPSSXpteGQUjplZ8Esu9A8Mon/wKsbGJ3CN/NupGzfwW/8A6UtPuhMyTU//NBdP0ldUIIjitt/wX8MS2xQk/fo3Vz3c/vXCOIgAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/62e3e7ec78c9d4f8cea9763ac32d1a28/65ed1/1.png&quot; srcSet=&quot;/static/62e3e7ec78c9d4f8cea9763ac32d1a28/65ed1/1.png 210w&quot; sizes=&quot;(max-width: 210px) 100vw, 210px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Navigate to &lt;code&gt;Repository&lt;/code&gt; tab and click &lt;code&gt;New&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:264px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:56.27906976744186%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAAByklEQVQoz42S32/SUBTH+c99MZFk0g4HD9NVjEBLW9bR29vC5gvhbQaNCfQXzjejD4w4MrRk6L6ee7simhm9ySffe89tv+eee26Jcw6B53kIguA3+oTruhiNRkjiGFEUIQxDqQXhdIqIYkmSYDgcoiSMBL7PYZomDMOAZVkwOh2ptm0jTVOIcb36is3mO7JsjWy9lvrj9hbfsgw3NxtMybzk3Z3Op9NojRfYq6hQqwd4rOyjvFeBTsbC8Hq1wvjtO0zCGGGcIpldYBrF+PjpM9LZe8wuPtwZkpksmbngjoWg14V/Ykvtu10cmzpiKvd/xmQyKQx9sJ4Dp/lshyOckFovjzAev8FyucR8Psfl5SJnkbNY5OsvV1c4P3+NUtEQ3/cxOHuFYHCK/ukZaU6f1mKvaF7xvWjWnzDG8hOKHxzHQaPRgEl31mq1YOg6OjRvt9ukJprNJnSKiT3RrN0Eu2wN7W4X1eoTVBQFiqqiVqtD057jUbmMWr2ex0griorDw6fyVdxrWJSQB+gumQfmcUnxpDyac0oqXoRUWTK7l22XXcbkPQSUeRDkcO5tTUWiXf0bW0NxoYJ97RgP6zYeHNjQ2j2Z4FcF/+YnrfC/LbN/mk8AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/70a4e0071911e022ab9c289df84edcaa/e61aa/2.png&quot; srcSet=&quot;/static/70a4e0071911e022ab9c289df84edcaa/2eb24/2.png 215w,/static/70a4e0071911e022ab9c289df84edcaa/e61aa/2.png 264w&quot; sizes=&quot;(max-width: 264px) 100vw, 264px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:291px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:47.906976744186046%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAAAsTAAALEwEAmpwYAAABxElEQVQoz5WSy2sTURSH58/xv3DtzoU7BXcKimtdVqyYhDSNbWlj6MrmMck8Ms8MmVQqFRsJ+NhUC4LbQHdCTTOZNJ/33naMiA8c+Dhzz+Xc+7vnd7QwDHBdl2ZTp1av02g02anV1dq2bcIwJAgChe/7eJ73W1zPVVFz3fNEVrQoDkTeJ9uXl8p8HMf0BHHcpx/vCvo/6PV6aNkBsnhxo6/UZMh9x3EYDofMZjPSNCWZJpwk3xgnpyKOmZ6ljEYjtFarTVNvYRimKrLEMw3TpC3WhmmpaFoWNdGGF3t7TJKU+dmc3Jdt7n5a5vbHh9w6XOLG4QPsowht9ek6hZVVntca2B0HvW2wvlmhVF6jvLZBoVhiq7rN8pM8Ow2drydjkmTKtf17XN69ztX9O9w8uM+l7hVW3lTRTLtDRkcoNC2btlR2oU4pFHt6y+DVwYDTaQpz0D8HPHq7Qf79M/LvKuQ+VHh59BpN9cw9b/qfHJR9lI4PBgOlbjKZwIwF4g75HY+O0X5u/r+Q5kRRRFcQdkPCSNK9iKHKab+Oy9/I5lBG+SJTtEUaKE2TZjoi998KFfJfDHyxVOaxMCtXKLJVqYrh9vgOea5wt9DWv/MAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/eaa8b9eed61d9e088d7ca71c35285c58/78805/3.png&quot; srcSet=&quot;/static/eaa8b9eed61d9e088d7ca71c35285c58/2eb24/3.png 215w,/static/eaa8b9eed61d9e088d7ca71c35285c58/78805/3.png 291w&quot; sizes=&quot;(max-width: 291px) 100vw, 291px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Name your repository &amp;amp; Create&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:750px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:89.30232558139535%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAACXBIWXMAAAsTAAALEwEAmpwYAAACNUlEQVQ4y5VUSY7bMBDUhwPkmnOQY96RD+QXWSYZIIshe7TZkLWLkqiVVKWbGm+JZzwhUOiWRBa7i0VZUkrY6w18P4DnuQa2bdO7NeqmgVIK0zSdQf0VF8zzDB5W23XYOA7cIIQdZNhsU/xyYqR5gaqqUJaCYg1BOceqrpd3HEUFQeCotV4ImZkfJqUxKEDRRgr/P5iHYQ3DYHY7jJryLE2RFwUayg8bzno+LtJnUc/6+GwImez++x1cf0ttNaYFP9jBI01zalsT0TRpyKE1i2/UCYuFX9kr+Nsd4iRFmmUGCeUJVRonCcXMREZRlMjynDROkJYRojykGJ8OpRs67KKAqhMYx/F4YgbUqj4HnfghV1qdoCZT3ULY94iixFSXUYuy7WgSH5IyllF0WOoivw4zn9ZZeBSdhTUfyF/jk5gwjBN18i/4PZNaTT8jKRrSLEZHnrw08qV5F6+dTvQarG6cSWCBMAzJoAJs9KaRaNvWoJGcdyYy6cFzTw2Ld2ybgnSMyHsletK063pDIomQn6VsL8ierZAncqs9GZyrO1W45Gwrrpz1uUVmCNkqnu/jge6zH2zhOC5cz4PjulhvHkzlbH6e91yrZy0DGV2zfRwjIuOG+4iMnRsz7ylnI3OlolpIb2qo+VoJarNsITJa1CvTXkZEOf1V9nGCsu4wabxMw2Ks8KX8gW/iN76WP+HKnTH9wcjLzXj8QbxEw/t8hVef3uLN3Xu8/vwOH5yPppLbP4Lr4w/R83ZzbA5gWAAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/7ef2c508edd983b7eb8e4eab2994ef3d/1d69c/4.png&quot; srcSet=&quot;/static/7ef2c508edd983b7eb8e4eab2994ef3d/2eb24/4.png 215w,/static/7ef2c508edd983b7eb8e4eab2994ef3d/05ed2/4.png 430w,/static/7ef2c508edd983b7eb8e4eab2994ef3d/1d69c/4.png 750w&quot; sizes=&quot;(max-width: 750px) 100vw, 750px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Grab your remote address. Copy it&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:436px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:18.13953488372093%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAECAYAAACOXx+WAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA7ElEQVQY01WMbU+CYBiF+fNUWmFALGG4mhul4gIxW2tWQKlt/ZJU3hQ3+3T1wKqtD9fOuc85uyXDvOTs3ETR26iGxeGxSks3OTrRaCq66CwOmi0apzqK1kZuKMJr6Bc21wMfp+/9Q6qeqIZZY3a6uN4d3viBwe2YoT8huJ/Wd2844sb1a6260eSRaP5BLPjVCkmWZSzLwrZtgiCgKDZkecF+/0Wa5SRJSrnbkaQZueg225K1yCqfZhnL1ZpM7D6XK7ZlidS5cug6PUGfnuvxEs9rwnjBUzir/VToczQjel389RXR23u9C3/ySr8BB839D8NVf3EAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/a5d07aba3397a836541c5e61aa281225/8574c/5.png&quot; srcSet=&quot;/static/a5d07aba3397a836541c5e61aa281225/2eb24/5.png 215w,/static/a5d07aba3397a836541c5e61aa281225/05ed2/5.png 430w,/static/a5d07aba3397a836541c5e61aa281225/8574c/5.png 436w&quot; sizes=&quot;(max-width: 436px) 100vw, 436px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;3-push-project-to-your-repository&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-push-project-to-your-repository&quot; aria-label=&quot;3 push project to your repository permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Push Project to Your Repository&lt;/h3&gt;&lt;div&gt;&lt;p&gt;If you are not familiar with bash commands, consider using &lt;a href=&quot;https://desktop.github.com/&quot;&gt;GitHub Desktop&lt;/a&gt; instead. &lt;a href=&quot;https://help.github.com/en/desktop/getting-started-with-github-desktop/creating-your-first-repository-using-github-desktop#step-4-push-your-repository-to-github&quot;&gt;Here&lt;/a&gt; is how you can push to your repository using Github Desktop&lt;/p&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Open Terminal and browse over to your project folder&lt;/p&gt;&lt;ul&gt;&lt;li&gt;On Windows, you can use &lt;a href=&quot;https://git-scm.com/downloads&quot;&gt;Git Bash&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Type in the following commands&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[INITIAL]: initial commit 🎇&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; remote &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; origin &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;YOUR_REMOTE_ADDRESS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push -u origin master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Tip)&lt;/strong&gt; Lazy to type all the commands? &lt;a href=&quot;/2019/04/alias&quot;&gt;Here&lt;/a&gt; is how you can set up shortcuts (alias)&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;That&amp;#x27;s it! Refresh your github repository to confirm&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Bash]: Resize multiple images on terminal]]></title><description><![CDATA[I ran into situation where I've had multiple screenshot images that were larger than necessary. Here is how you can conveniently resize…]]></description><link>https://ellismin.com/2019/12/resize-imgs/</link><guid isPermaLink="false">https://ellismin.com/2019/12/resize-imgs/</guid><pubDate>Sat, 28 Dec 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:381px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:71.16279069767442%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAABk0lEQVQ4y52TzU7CUBCFSVy5FpW2tGXrQugfv6WlUBCjFYMCKRpNjL6BT+CTsDERnvI4c235WRipi0k7N7lfzpkzN9d4X+Ds6QvO6wrO2wrGy1J8pftPHAwWOLxeQht+wLEMzOMYHc9D0OlgEIawDANus4leEKDf68Eol5GTj/NQTvOQTo5E8T9XkUot0D+daUUZJl2+jSL4BGRo2O3CNk0Evo8OFfcCWJQV7JYMJSnuFUmGrmlwbBvxdEbA9hrgWBa8dntXYVFc/L0USYKuaqg6Dh7JMgNSICv0XFf0DDUqlT2AhQJKuo7KeRkXYV9cFpZJUQpsNhr/AJYruBpe7gA5FJ5pl2BbM/zbsqaqqJHl54f5xjIDSSHDfTrLBORQbApgdjf+SXkL2KzXBTRbKAJoYzaZblJOgJx0l/ayT3u5N7BEQLGHN5FQs54hAd1WSwSTCSgUmjbmkzhZ7N0Z1qrV7DN0yHI8mW1eSrI2jVpNKMwEXFuOIqFue4Z1Upf2mRTyzo1HI7EifvLc+IztctIp8Bsdm62t7vypdwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;resize img 1&quot; title=&quot;resize img 1&quot; src=&quot;/static/264dacb1ea33cf291b0fca0621189977/2add2/resize-img-1.png&quot; srcSet=&quot;/static/264dacb1ea33cf291b0fca0621189977/2eb24/resize-img-1.png 215w,/static/264dacb1ea33cf291b0fca0621189977/2add2/resize-img-1.png 381w&quot; sizes=&quot;(max-width: 381px) 100vw, 381px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;I ran into situation where I&amp;#x27;ve had multiple screenshot images that were larger than necessary. Here is how you can conveniently resize multiple images that may take up less space on your PC storage with bash command.&lt;/p&gt;&lt;h3 id=&quot;caveat&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#caveat&quot; aria-label=&quot;caveat permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Caveat&lt;/h3&gt;&lt;p&gt;It may be a good practice to leave the original files in case they&amp;#x27;re needed in the future.&lt;/p&gt;&lt;h3 id=&quot;on-terminal&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#on-terminal&quot; aria-label=&quot;on terminal permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;On terminal&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;sips -Z 600 *.png&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;sips: image processing system&lt;/li&gt;&lt;li&gt;-Z: maintains the images&amp;#x27; ratio&lt;/li&gt;&lt;li&gt;600: maximum width of the image that you&amp;#x27;d like to convert to&lt;/li&gt;&lt;li&gt;*.png: selects all the files in the directory that has an extension of png&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;another-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#another-example&quot; aria-label=&quot;another example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Another example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;sips -z [height] [width] *.png&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;It resizes the images to specified dimensions that can alter the aspect ratio of the image&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;result&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#result&quot; aria-label=&quot;result permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Result&lt;/h3&gt;&lt;p&gt;46 images (6.6MB) were converted to 4MB&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:382px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:60.930232558139544%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAABd0lEQVQoz52SzU7CUBCFeQONUfqHxh1toFTa0gj9u8VAXVSwIiYmrjRudMHLaNxqNJr4ksc7FwoaY0JdTO70pvPdM2emYs3e4M0+Ed6+Irn/ALt7h3f9gsObZ9hXT9gbP0DOHtGwfUzyEZIkQb/fF6fv+7BtG3EcI4oiMMZQabIUB34Mp6XDtS04bRNuu4lWQ8f21gbknU3s78owDB3HaYowDEUhQbrdLjzPEw8EQTAHKlIVUpWHLKMqSZAkmecKZB6aVoOqalD5Wdd1TM8mYBzEEiaKe70eXNcVapdArUZF6p+hKATWoBNwsgCyFbDT6SzzOZD/TEXrAKMgEkpIUdEyeUh3lNN9KeDgaCA8pEJSUwDJQxpQKYXk4eXF+bLdAkgeUl4aSArHWYaYr8d3hZZliZUppl8CWEee58K7Ym1oEKZpChh9U5RSmA6Hvzx0HEcMZbU2awINw8D0dMrXhv0A0tqQf/+a8ig7QbRoj3wrPKTWi6F8AXQ5cxFx4lmaAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;resize img 2&quot; title=&quot;resize img 2&quot; src=&quot;/static/8b703ffe64dfabc130346dc2486981d7/77edc/resize-img-2.png&quot; srcSet=&quot;/static/8b703ffe64dfabc130346dc2486981d7/2eb24/resize-img-2.png 215w,/static/8b703ffe64dfabc130346dc2486981d7/77edc/resize-img-2.png 382w&quot; sizes=&quot;(max-width: 382px) 100vw, 382px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Node pkg]: Install sass with npm]]></title><description><![CDATA[Initialize npm in project directory -y flag skips the prompts Install sass with npm In the project directory, scripts in package.json Modify…]]></description><link>https://ellismin.com/2019/12/install-sass/</link><guid isPermaLink="false">https://ellismin.com/2019/12/install-sass/</guid><pubDate>Thu, 05 Dec 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;initialize-npm-in-project-directory&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#initialize-npm-in-project-directory&quot; aria-label=&quot;initialize npm in project directory permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Initialize npm in project directory&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;npm init -y&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;-y flag skips the prompts&lt;/p&gt;&lt;h2 id=&quot;install-sass-with-npm&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-sass-with-npm&quot; aria-label=&quot;install sass with npm permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install sass with npm&lt;/h2&gt;&lt;p&gt;In the project directory,&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;npm i node-sass&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;scripts-in-packagejson&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#scripts-in-packagejson&quot; aria-label=&quot;scripts in packagejson permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;scripts in package.json&lt;/h2&gt;&lt;p&gt;Modify scripts in &lt;em&gt;package.json&lt;/em&gt; file&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;sass&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;node-sass -w scss/ -o src/css --recursive&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make sure to have scss files in &lt;em&gt;scss&lt;/em&gt; folder under project root, and locate source files under &lt;em&gt;src&lt;/em&gt; folder.&lt;/p&gt;&lt;h2 id=&quot;npm-run&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#npm-run&quot; aria-label=&quot;npm run permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;npm run&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;npm run sass&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will create a compiled css file at &lt;em&gt;./src/css/main.css&lt;/em&gt;&lt;/p&gt;&lt;h2 id=&quot;&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#&quot; aria-label=&quot; permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;+)&lt;/h2&gt;&lt;p&gt;When using git, create &lt;em&gt;.gitignore&lt;/em&gt; to ignore &lt;em&gt;node_modules&lt;/em&gt; folder&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Git + cron]: Schedule your git commands with cron job]]></title><description><![CDATA[Note: cron has been deprecated in favor of launchd on macOS launchd: In computing,  launchd , a unified operating system service management…]]></description><link>https://ellismin.com/2019/11/git-cron/</link><guid isPermaLink="false">https://ellismin.com/2019/11/git-cron/</guid><pubDate>Thu, 21 Nov 2019 00:00:02 GMT</pubDate><content:encoded>&lt;h1 id=&quot;note-cron-has-been-deprecated-in-favor-of-launchd-on-macos&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#note-cron-has-been-deprecated-in-favor-of-launchd-on-macos&quot; aria-label=&quot;note cron has been deprecated in favor of launchd on macos permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Note: cron has been deprecated in favor of launchd on macOS&lt;/h1&gt;&lt;p&gt;&lt;strong&gt;launchd:&lt;/strong&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p&gt;In computing, &lt;strong&gt;launchd&lt;/strong&gt;, a unified operating system service management framework, starts, stops and manages daemons, applications, processes, and scripts in macOS. It was introduced with Mac OS X Tiger and is licensed under the Apache License — &lt;a href=&quot;https://en.wikipedia.org/wiki/Launchd&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;p&gt;More information about launchd is handled in &lt;a href=&quot;/2020/03/launchd-1&quot;&gt;this post&lt;/a&gt;&lt;/p&gt;&lt;h1 id=&quot;using-git-commands-with-cron-scheduler&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#using-git-commands-with-cron-scheduler&quot; aria-label=&quot;using git commands with cron scheduler permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using git commands with cron scheduler&lt;/h1&gt;&lt;h3 id=&quot;create-a-repo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-a-repo&quot; aria-label=&quot;create a repo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create a repo&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:67.90697674418605%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAABiElEQVQ4y5VT21KDMBTs/4+vPvroV/jsP6i9aFuhrQUSINeSsJ6EorSlHc3MmeUEWHbPhknbtgiraRrMF+9YfKwwe1/idTpHnhdQWkMpdUQdUVKvCft3ewxr0jfee9RCgAsDJh100z3YOBc/dlnuhLC/ngwVpukGSZqiKksYo0mFgbH2RMFwDYkuCAMWrMQ+Z6T2d8859/PiaKG9otA1YJzIqJdSIctz1LWID/obCtFiXKEjwtn8DdvdHoxxfCZJHAHjJSpRUxAS1lhooyCNoFHojgjteCjBWkap7rMsKrOHA83RdsmqQcJaolZVxJszdDQ3IbsgQoKOUnfOx/1YdN2445479mdJDwjpeHhgl3FSmcFSsjFhY8hih8HBMNmhzRPLGNyUoqKkWbQaCANZsBrwVtJXLHuUdP44FeM8EgcM/YHmea7uJmHffFHC63WCJAkHfIPlao28YDRbFf+ka2v812s9ClFiyzNUSpBNC17VsbRt/m+5sBz300fcvTzgafs8ouJvlr8BIxZIyIJr5roAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/4644e7a8125b8cc171967bab0c699d5a/914ae/1.png&quot; srcSet=&quot;/static/4644e7a8125b8cc171967bab0c699d5a/2eb24/1.png 215w,/static/4644e7a8125b8cc171967bab0c699d5a/05ed2/1.png 430w,/static/4644e7a8125b8cc171967bab0c699d5a/914ae/1.png 860w,/static/4644e7a8125b8cc171967bab0c699d5a/33a7b/1.png 1119w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;if-you-havent-set-up-ssh-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#if-you-havent-set-up-ssh-key&quot; aria-label=&quot;if you havent set up ssh key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;If you haven&amp;#x27;t set up SSH key&lt;/h3&gt;&lt;p&gt;Please follow &lt;a href=&quot;/2020/03/git-auth-ssh&quot;&gt;this post&lt;/a&gt; to link your SSH key on your machine with your GitHub account &lt;strong&gt;before proceeding&lt;/strong&gt;&lt;/p&gt;&lt;h3 id=&quot;create-a-file-thatll-be-pushed&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-a-file-thatll-be-pushed&quot; aria-label=&quot;create a file thatll be pushed permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create a file that&amp;#x27;ll be pushed&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; READ.md&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;md&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-md&quot;&gt;MD&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-md&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token title important punctuation&quot;&gt;##&lt;/span&gt;&lt;span class=&quot;token title important&quot;&gt; This file will be pushed to github repo with cron&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Then save&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;create-sh-script&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-sh-script&quot; aria-label=&quot;create sh script permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create .sh script&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;newrepo.sh (Example)&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; init&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; README.md&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;[INITIAL]: initial commit 🔥&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; remote &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; origin https://github.com/EllisMin/auto-pushed-contents.git&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push -u origin master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Save it then grant executable permission with &lt;code&gt;chmod +x newrepo.sh&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;check-your-computers-time&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#check-your-computers-time&quot; aria-label=&quot;check your computers time permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Check your computer&amp;#x27;s time&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;date&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;schedule-with-cron&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#schedule-with-cron&quot; aria-label=&quot;schedule with cron permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Schedule with cron&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;crontab&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -e&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;sudo allows you to run script as &lt;strong&gt;root&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; 03 * &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/Desktop &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ./newrepo.sh&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# Minute | Hour | Date | DayOfWeek | Script&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;The shell script will be run at 03/21 at 9:10AM&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;outputting-result-into-file&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#outputting-result-into-file&quot; aria-label=&quot;outputting result into file permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Outputting result into file&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; 03 * &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/Desktop &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ./newrepo.sh &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; /tmp/result &lt;/span&gt;&lt;span class=&quot;token operator file-descriptor important&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token file-descriptor important&quot;&gt;&amp;amp;1&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Output result in &lt;code&gt;/tmp/result&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;2&amp;amp;&amp;gt;1&lt;/code&gt; indicates that standard error is redirected to &lt;code&gt;/tmp/result&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;view-list-of-active-crontab-jobs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#view-list-of-active-crontab-jobs&quot; aria-label=&quot;view list of active crontab jobs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;View list of active crontab jobs&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;crontab&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -l&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;ran-into-trouble-macos&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#ran-into-trouble-macos&quot; aria-label=&quot;ran into trouble macos permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Ran into trouble? (macOS)&lt;/h3&gt;&lt;p&gt;If somehow doesn&amp;#x27;t work, try giving Full Disk Access to &lt;code&gt;/usr/sbin/cron&lt;/code&gt; and &lt;code&gt;/usr/bin/crontab&lt;/code&gt; on &lt;code&gt;System Preference &amp;gt; Security &amp;amp; Privacy &amp;gt; Privacy &amp;gt; Full Disk Access&lt;/code&gt;. Press &lt;code&gt;command + shift + G&lt;/code&gt; to open &lt;em&gt;go to folder&lt;/em&gt; to type in manual directory.&lt;/p&gt;&lt;h3 id=&quot;more-examples&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-examples&quot; aria-label=&quot;more examples permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More Examples&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token number&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; * * &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;-5 /some/dir/script.sh&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Execute every business day at 1:11PM&lt;/p&gt;&lt;/blockquote&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;*/10 * * * * /some/dir/script.sh&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Execute every 10 minutes&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;schedule-your-mac-to-wake-up&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#schedule-your-mac-to-wake-up&quot; aria-label=&quot;schedule your mac to wake up permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Schedule your mac to wake up&lt;/h3&gt;&lt;p&gt;&lt;code&gt;cron&lt;/code&gt; doesn&amp;#x27;t execute while your computer is asleep, but you can schedule your computer to awake a minute before scheduled cron job.&lt;/p&gt;&lt;p&gt;For macOS: &lt;code&gt;Preference&lt;/code&gt; &amp;gt;&amp;gt; &lt;code&gt;Energy Saver&lt;/code&gt; &amp;gt;&amp;gt; &lt;code&gt;Schedule&lt;/code&gt;&lt;/p&gt;&lt;h3 id=&quot;check-logs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#check-logs&quot; aria-label=&quot;check logs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Check logs&lt;/h3&gt;&lt;p&gt;On linux, cron job gets logged at&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;/var/log/system.log&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the following to filter cron jobs&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;grep CRON /var/log/system.log&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React]: Redux Basics]]></title><description><![CDATA[Redux As apps get bigger, states of the app will become more complex and difficult to understand the flow of data. Redux  is a React library…]]></description><link>https://ellismin.com/2019/11/react-redux-1/</link><guid isPermaLink="false">https://ellismin.com/2019/11/react-redux-1/</guid><pubDate>Fri, 08 Nov 2019 00:00:02 GMT</pubDate><content:encoded>&lt;h2 id=&quot;redux&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#redux&quot; aria-label=&quot;redux permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Redux&lt;/h2&gt;&lt;p&gt;As apps get bigger, states of the app will become more complex and difficult to understand the flow of data.&lt;/p&gt;&lt;p&gt;&lt;em&gt;Redux&lt;/em&gt; is a React library which allows react state to be &lt;strong&gt;more scalable&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;why-redux&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#why-redux&quot; aria-label=&quot;why redux permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Why Redux?&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;Helps with state management&lt;/li&gt;&lt;li&gt;Efficient for sharing data between components&lt;/li&gt;&lt;li&gt;Predictable statement management with 3 principles&lt;ul&gt;&lt;li&gt;Single source of truth&lt;/li&gt;&lt;li&gt;State is &lt;strong&gt;read only&lt;/strong&gt; (immutability)&lt;/li&gt;&lt;li&gt;Changes made by pure functions&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Instead of &lt;strong&gt;each component&lt;/strong&gt; holding a different state, &lt;em&gt;Redux&lt;/em&gt; allows to have &lt;strong&gt;one huge object&lt;/strong&gt;(state) that describes the entire app and can be passed down to whichever component that needs it.&lt;/p&gt;&lt;h2 id=&quot;redux-flow&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#redux-flow&quot; aria-label=&quot;redux flow permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Redux Flow&lt;/h2&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:491px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:25.581395348837212%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA+klEQVQY022NS0/CYBBF+/td6Mq1O0OMj4j42BrlYS00UQRSYosKNIgGBPrmm2NpQwjGyZzczM2dGe3HOEA/2eG5tIdZ3KV/u4+a9liViEqRjHyWLf7zNBVMSPyc5Uq9b1QSkcVlQ7awHvNb+VGRraCmEgVpy0r/lGKZRlTG2kHiVGNEJax/KtmgeWadfvmOecNgPhzw6jgMPvp03to8dGpUXyq03pssFh7B1GLm1pgOKohvZ17LGWO0XUxrxGN7hDa+ucQqHOKen+G7Q/woIvRDmr0nSvVTivoxerdMEMR44wZf3SM+rQLxxCQII/TWkIt7m6uqzXWtxy8i2HgV7Gc04wAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 13&quot; title=&quot;3 13&quot; src=&quot;/static/a092528e8fd8fba260d63605845b2786/13566/3-13.png&quot; srcSet=&quot;/static/a092528e8fd8fba260d63605845b2786/2eb24/3-13.png 215w,/static/a092528e8fd8fba260d63605845b2786/05ed2/3-13.png 430w,/static/a092528e8fd8fba260d63605845b2786/13566/3-13.png 491w&quot; sizes=&quot;(max-width: 491px) 100vw, 491px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Action&lt;ul&gt;&lt;li&gt;What user does&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Root Reducer (App state)&lt;ul&gt;&lt;li&gt;Pure function that receives action. Returns updated state(store)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Store&lt;ul&gt;&lt;li&gt;Describes what app should look like&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;DOM changes&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;+) &lt;strong&gt;Middleware&lt;/strong&gt; receives action object before reaching root reducer, do something with it, then, pass it onto root reducer.&lt;/p&gt;&lt;h2 id=&quot;flux-pattern-vs-mvc&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#flux-pattern-vs-mvc&quot; aria-label=&quot;flux pattern vs mvc permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Flux Pattern vs MVC&lt;/h2&gt;&lt;h3 id=&quot;flux-pattern&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#flux-pattern&quot; aria-label=&quot;flux pattern permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Flux Pattern&lt;/h3&gt;&lt;p&gt;Redux uses a flux pattern that&amp;#x27;s also &lt;strong&gt;unidirectional&lt;/strong&gt; data flow.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:441px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:28.37209302325581%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAABF0lEQVQY05WO20oCYRSF582DLnyDniEsMCGlnKQbQUKxqbEkyfKQhwmdk//4z0Hn/5rULqIuasFi771YrL00o5DDLOa4OT6gkT/EqR+xdl75hFIp/4UmJm3EuI0/usd7M4msRzahj9oHKqX24eoHf9O1v3zdBn/t3/Rv166hch1SZ0Hi2Ht5gx+5rDYBy8QnTOTOn0pUPM8M3naqNNnKIsz8UiEi8II12qByweTqEmm0kMuAwaxP9U6n0qigt3R6712ECPEtA2ldM+qUWC9qxMEY2/F4GAY0uzb19pSulaK9nObpZ3TrNZIoYWZP0c0S5WaRcussC3wijrMGc5PlsMCkc0IwPidezVjJEKPnUr210Bsjms+CD9pxxCohNlmVAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 12&quot; title=&quot;3 12&quot; src=&quot;/static/ef27b6205d2ea2ed09e031e8d4e74c43/efc6e/3-12.png&quot; srcSet=&quot;/static/ef27b6205d2ea2ed09e031e8d4e74c43/2eb24/3-12.png 215w,/static/ef27b6205d2ea2ed09e031e8d4e74c43/05ed2/3-12.png 430w,/static/ef27b6205d2ea2ed09e031e8d4e74c43/efc6e/3-12.png 441w&quot; sizes=&quot;(max-width: 441px) 100vw, 441px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;mvc&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#mvc&quot; aria-label=&quot;mvc permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MVC&lt;/h3&gt;&lt;p&gt;On the other hand, MVC model uses&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:543px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:60%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAACBUlEQVQoz42Ta1ObUBRF8///Rz93Rq3Tph2rxkdirZPRJBIfMRpNYiAQ4HKBAHf1BNTadzdzZoC5s9jn7EONJ5mnwhhe3sm9eXou8oR41mB2vcnSaWHiRF5CqnL6o5izYUj7JqRmt99y1XiDHmxj8vQF9Bq6UuC7hJMG99YGaixnIw9ySKKczq1m5+SW/Z5HTd0eMevvkUw6Asx+cPbdoWHhhyi7zXz4Af/+I8YfghxPdE73Lua479Ds+9T4Sa/dPSvPMgEqAucCf/SJh/46ZnEKsSHxBTjUtHrTCpgFIXlZAflqLqKsyFBpSJQq4kzjLVyCQKGVSzRtCPCdzHNPZqikZTi7iWidzzg4X1ALG/tcr68xq9dR3XN0nDIYX7FrbbNxuM52d4u2dUIYRASLqQB3pe06iX0oiSQkC1M63D+9p2kJcOm4lGXPycTFSmmW4EZzPO0yVw6j8YgoilFOB++uzoO1hnF6oKsZrkL5IjM8tP5nhvKoVIz7eImefsZ/2CK3m+SeW67Nc8oHnbEAxeGvib5KWa6iMLIyc7TdYnKxWTokuKRI5KxsWeJJKDeaI2tWtcwfVMKlhEfo9HEGm9iD9xTeqcCWmKKynywLuiNNszv5N7ByKanrKWp2LPUVk9olzAioarkoW271HquW+Yt+s5Ivi159ahV0QU9+vVUox1cB3wAKbpF5Y4FLRgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 11&quot; title=&quot;3 11&quot; src=&quot;/static/6e98ee34f26af5f9f25b6a55af13bcaa/29579/3-11.png&quot; srcSet=&quot;/static/6e98ee34f26af5f9f25b6a55af13bcaa/2eb24/3-11.png 215w,/static/6e98ee34f26af5f9f25b6a55af13bcaa/05ed2/3-11.png 430w,/static/6e98ee34f26af5f9f25b6a55af13bcaa/29579/3-11.png 543w&quot; sizes=&quot;(max-width: 543px) 100vw, 543px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;When user makes an action, based on what &lt;strong&gt;controller&lt;/strong&gt; says, we update the &lt;strong&gt;model&lt;/strong&gt;(state), then it updates the &lt;strong&gt;view&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;The controller changes different models, and each model can change different views which may trigger other models to change--the &lt;strong&gt;relationship would be very difficult to understand&lt;/strong&gt; in larger apps.&lt;/p&gt;&lt;h2 id=&quot;what-reducer-looks-like&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-reducer-looks-like&quot; aria-label=&quot;what reducer looks like permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What reducer looks like&lt;/h2&gt;&lt;p&gt;Reducer is a pure function that represents all of the states of our application.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Initial state of reducer just like this.state in constructor&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;INITIAL_STATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;currentUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// If state is undefined, set it to INITIAL_STATE (ES6 feature)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userReducer &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;state &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;INITIAL_STATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; action&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;switch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;SET_CURRENT_USER&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// return new obj to allow re-render&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;currentUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; action&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;payload&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// return state.currentUser = action.payload;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ^ the same obj so it won&amp;#x27;t re-render&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// If action doesn&amp;#x27;t match&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userReducer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;Note: if/else statements are also okay&lt;/em&gt;&lt;/p&gt;&lt;h2 id=&quot;installing-redux-libraries&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#installing-redux-libraries&quot; aria-label=&quot;installing redux libraries permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing Redux Libraries&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ npm i redux redux-logger react-redux&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In &lt;em&gt;index.js&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Provider&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-redux&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Provider&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;BrowserRouter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;BrowserRouter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Provider&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Wrap around the entire app since we want to have access to store object from anywhere.&lt;/p&gt;&lt;h2 id=&quot;how-root-reducer-looks-like&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#how-root-reducer-looks-like&quot; aria-label=&quot;how root reducer looks like permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How root reducer looks like&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; combineReducers &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;redux&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;userReducer&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./user.reducer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// All full redux object is one big json object&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;combineReducers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userReducer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;what-store-looks-like&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-store-looks-like&quot; aria-label=&quot;what store looks like permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What store looks like&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; createStore&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; applyMiddleware &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;redux&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;redux-logger&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;rootReducer&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./root-reducer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; middlewares &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; store &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createStore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;rootReducer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;applyMiddleware&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;middlewares&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; store&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;back-in-indexjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#back-in-indexjs&quot; aria-label=&quot;back in indexjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Back in index.js&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Provider&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-redux&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./redux/store&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Provider&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; store&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;store&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;BrowserRouter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;BrowserRouter&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Provider&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;import &amp;amp; pass into provider&lt;/em&gt;&lt;/p&gt;&lt;h2 id=&quot;create-actions&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-actions&quot; aria-label=&quot;create actions permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create actions&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;setCurrentUser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SET_CURRENT_USER&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;payload&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;in-header-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#in-header-component&quot; aria-label=&quot;in header component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;In header component&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; connect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-redux&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// state is root reducer&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;mapStateToProps&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;mapStateToProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;updating-reducer-value-in-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#updating-reducer-value-in-appjs&quot; aria-label=&quot;updating reducer value in appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Updating Reducer value in &lt;em&gt;App.js&lt;/em&gt;&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; connect &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-redux&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; setCurrentUser &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/user.actions/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  unsubscribeFromAuth &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setCurrentUser &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;unsubscribeFromAuth&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;onAuthStateChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// set state from data in db&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userRef &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createUserProfileDocument&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        userRef&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;onSnapshot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;snapShot&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCurrentUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; snapShot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;snapShot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCurrentUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// setting it to null on logging out&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ... }&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;mapDispatchToProps&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;setCurrentUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCurrentUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  mapDispatchToProps&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;Header is no longer dependent on App.js, but App updates user reducer values so header can get the latest user property.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Now you can see the log on the console&lt;/em&gt;&lt;/p&gt;&lt;h2 id=&quot;redirecting&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#redirecting&quot; aria-label=&quot;redirecting permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Redirecting&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Switch&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Redirect&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-router-dom&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/signin&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;currentUser&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag class-name&quot;&gt;Redirect&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag attr-name&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag attr-value&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag class-name&quot;&gt;SignInAndSignUpPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;mapStateToProps&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;currentUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;currentUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;mapDispatchToProps&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;setCurrentUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dispatch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setCurrentUser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;mapStateToProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mapDispatchToProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React]: Firebase with React]]></title><description><![CDATA[Set up Firebase database for user authentication in React project]]></description><link>https://ellismin.com/2019/11/react-firebase/</link><guid isPermaLink="false">https://ellismin.com/2019/11/react-firebase/</guid><pubDate>Fri, 08 Nov 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;intro&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#intro&quot; aria-label=&quot;intro permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Intro&lt;/h2&gt;&lt;p&gt;For our web pages, &lt;em&gt;Firebase&lt;/em&gt; provides us with&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Authentication&lt;/li&gt;&lt;li&gt;Database&lt;/li&gt;&lt;li&gt;Server&lt;/li&gt;&lt;li&gt;...&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;This post will mostly focus on &lt;strong&gt;authentication&lt;/strong&gt; and &lt;strong&gt;database&lt;/strong&gt; by creating sign in and sign up functionalities with React.&lt;/p&gt;&lt;h2 id=&quot;1-set-up-firebase-project&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-set-up-firebase-project&quot; aria-label=&quot;1 set up firebase project permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Set Up Firebase Project&lt;/h2&gt;&lt;p&gt;On this &lt;a href=&quot;https://console.firebase.google.com/&quot; target=&quot;_blank&quot;&gt;page&lt;/a&gt;, create a project with Firebase.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:106.04651162790697%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAYAAABG1c6oAAAACXBIWXMAABYlAAAWJQFJUiTwAAACoElEQVQ4y5VUzW7TQBDOA/AASIgDZ7jCgV648B6cOYKAEycQSEg8Ai/QK1LVQxGlaehf2pKSOD9tnb+msZ048d96bcfNx+ymTpO2SoKl0c7Mzs58s994Ux7jEOJ6PmzHg+OyKV2swk78Pg/B/ECut0mqbzmwbBdGx0Sj2cJ5W0frXBvrtXqT9rrQNAOdbm9+wtucsw7M2pMJRcB1SQ7O27tNT00a4i6TgORur+uT9qQvyZNKkkWDC8QXwCAeSrkYQtphFMtViIhJ4kaxV/FTCMWhglLCxsYmtnd28Sd3hPVfaaTTGeQLCtKbGaysrKJUriCfV/B7axs/1zewlz0gfQe7e1lJLA+iUcIgHOCs1capWkOLVsFwuXKCeuMMXbOPcvn40m5K1gtKEcVSRfpqtQbUan08UuOExyeqrJg7yhOqIlXdRyazhS1CoBRL8grC6GbLwr7Rskgo0ImKVapYOT4lUXFwmKNkFZpLfYq0maSMWWYEmTFw30ccU2n6BCrxCXveOCUyQkiX2dRtlOtdlOo9tLo+lCaDaXNUWgztHqeY+UMtEXpiZMIQ+yrHD8XHWoFhLe9hecfF34aP74cuDqu+jPHmoJMIkzZcEod0j9C6PAIjRH2P/DyAxQJ03QDmAjK+Q8f15YgYnZ58BJyJl2WRVqf+ZaFYDoNOyXR6dXTDhE0FPD+EywSrly3x/2h5EIVE6+BK4gjDQUjqSDhfkJQRyyFUjSOrMiKAIXvKsHvCcFBlkpBc3YdF97NI0pRoCXGIF99M3Hl5jvtvNDx8r+PxBwMP3mm4+6qNe681WUzEifjZY0MBQwp8u9zHI0q09MnAsy8dPP/awdJnA08+GnhKPjFConWPBYuRYtOImDaJE6BjBTCsK7vnTD+isxL+A2ItMgFF9MCBAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 1&quot; title=&quot;3 1&quot; src=&quot;/static/7625c65d8e55464e10cde11e0b4e650f/914ae/3-1.png&quot; srcSet=&quot;/static/7625c65d8e55464e10cde11e0b4e650f/2eb24/3-1.png 215w,/static/7625c65d8e55464e10cde11e0b4e650f/05ed2/3-1.png 430w,/static/7625c65d8e55464e10cde11e0b4e650f/914ae/3-1.png 860w,/static/7625c65d8e55464e10cde11e0b4e650f/99f37/3-1.png 1100w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:104.18604651162791%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAYAAABG1c6oAAAACXBIWXMAABYlAAAWJQFJUiTwAAACg0lEQVQ4y5VUuZLTQBBVzCeQEPBnZMRUAQkRAQW/QtUGFEVAAmSw4LVZ3/clyZIl67BlHbbXzbyWRx6zFwRPc6j7TR9vRgvCFVm2Q+OJToZpkW7MaDI1eATwP0k3tI5TipPsXmj4wCHNtjyezrdsJMn+hVRTjW+a/zchPsvVmqJ1wg6rKGZgne/HvJ//T+4l15Berd6kUqlMX75+o4tyhcqVS/r+4yedn/+iy2qdia/2RNvdnrLN7s5ImbDd6Qr0qFprUKfbZ5LSRVms69Rqd6nXH1BH/Md8qptFk1TIqJlwOBoLTJgUznCqN5pUFcSNZpuJQF75XeXOw0eNSiXlpuBE2W0JpAZH2XGsAcxlnSWkDUcIov5gJCJqcS2RcrfXVyJrUFPMm60O2yDyVrvDY63e4D1DRL3wgmOXIWiQjsYTTh3o9Ycs9sFwzCXBf/3g6AdLhueHvHYXPl+AE9nAIFxGxYg9ACnJOaRzU3kkipRBglO8w2kgkY5/Q+2o1O5JU/CRkYEM8zTbFadKIhwCG8f1GO7CKyJW7YoI8UDgUYBkZtac7LnLe6iR7KwfhLxvzx0eHXdBjrNge9SzSBnGcNYFWU5o8yGyhtIG5HA2Z3aBvETHq8uE6JDnB4dUfB7hDCNVuFgDxX2P8nt+krLcgDileKWo1efsrhdGbYwGB+SvGybrD7qbTHXWoCn0aRweXNgcuyxepXVKy+g6OOVYPEuhSHsuCjx3XC6B1J6qwTyiPJL9NiOizTVosfgZrFIKo+zk7t6WWiSw22T0uRrRqzOf3n0K6K3Am48Bvf4Q5BFaXkIzLylOvx0Zp0r7jF6890l7YtCj5xY9fmnTw2cWPXhq0h/c/jY0OqgBEQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 2&quot; title=&quot;3 2&quot; src=&quot;/static/b966517c555889adeb4ef64f2df6bbf4/914ae/3-2.png&quot; srcSet=&quot;/static/b966517c555889adeb4ef64f2df6bbf4/2eb24/3-2.png 215w,/static/b966517c555889adeb4ef64f2df6bbf4/05ed2/3-2.png 430w,/static/b966517c555889adeb4ef64f2df6bbf4/914ae/3-2.png 860w,/static/b966517c555889adeb4ef64f2df6bbf4/46115/3-2.png 1290w,/static/b966517c555889adeb4ef64f2df6bbf4/e2d3b/3-2.png 1466w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Optional to import Google Analytics&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Then, go to &lt;em&gt;Project Overview&lt;/em&gt; and click &lt;em&gt;&amp;lt;/&amp;gt;&lt;/em&gt; for web application.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:51.162790697674424%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAACJElEQVQoz4WSTU8TYRSFZydixHa0pV+JnWlnOtgqJS2ljENJUTTSD4kLNv4FinTAAhoxQUm1EA3VuHfpSrf8BjckGhNAjAZoO9MWo3/geGcKUbGJi5N7J3nnec+952UEMQ5JjIHvUSD5o3B4LqArPA5nbguuWR1OtQrXTM2Ug/rehzriy3UoxTr6H2uILO/DO7cJcWGTzn8GI/Qm4Q8q8EiX4Q0Mws5HYA3fJOD2P0CjDz7QEH2kI7qk4dJiDSH65gpfIdzfhvMuAfnBDJx9o+gSFVh6hmEJyGDD2b+ARzKgtukq7CTbnT2cm9qFnaojX6Gz+3AUvhFwYAz8QAoCgbsvjsBKK2DbODyCemaNnn6e3jXlzLeqS63Arn4BE746AUHOwk0uLVICrOmw/cjd+SoST+tIlnQknmi4Uqrh+mrN7OWijnR5D4w0NA4uNtZy9x+gEcrISgPptSayL5pIrh5AWTnAtWcNDNNFRmU4GlmQM4cOh2ClYI7v8M9Q3DSyt1ADP69DVHcQyn1AYL4Cbk6DsKCB8fbfgC+ehj2UBEuhsJKMs32/HboOgW4SO1XF8/WfWHz3A+X171h7vYE3bzcQyH1CeKlJYVXAnAko6OTjpk75ZHRyUZwOpto6NBK+9bKJTLmBiVdN3C5+xGTpPfzTO/Ddq5uXM3w8Rc4S6OBiOEnQjvMRnBBH4ZjcOpZyC2o8GZdq7JM0o8Om6lQ1ejqtc78AxhG8P9FlVboAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 3&quot; title=&quot;3 3&quot; src=&quot;/static/f034f12450195d5f1496727192684cd3/914ae/3-3.png&quot; srcSet=&quot;/static/f034f12450195d5f1496727192684cd3/2eb24/3-3.png 215w,/static/f034f12450195d5f1496727192684cd3/05ed2/3-3.png 430w,/static/f034f12450195d5f1496727192684cd3/914ae/3-3.png 860w,/static/f034f12450195d5f1496727192684cd3/46115/3-3.png 1290w,/static/f034f12450195d5f1496727192684cd3/df438/3-3.png 1556w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;After, register app with any name and &lt;strong&gt;copy the selected code snippet&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:92.55813953488374%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAATCAYAAACQjC21AAAACXBIWXMAABYlAAAWJQFJUiTwAAACHklEQVQ4y5VUy5LSQBTN/7h14d4f8UdcWW4sf8DFlDv/QJcUIIUUsBCwYKgJQ03mESYP8u68OdO3sWOClmSoOtybpPv06XtutxLHMebzOTqdDsbjMXq9Hvr9vniezWaYTqdYLBYYDAZYr9fi23A4xGg0QrfbRRRFyPMcaZoiyzIoGU/iOAER04skOeY0kCI9U06QOcUwDAUkUUVICcoMRZ7xF7lYTYIGEOrP9ShzSSYIc/53ZyVwwwQsOq4q1dHANmgoxCHDh28eptcMW3XF6/ULm80GqqpWtakrOAdFJL8nkTrf9xEEgQBjrFq9LZT6BNd1BTzPE5HI6w62Vkiu0aT9fg9N08SWDcMA/cqyxOFwqOI5KKdbkm1DkUiKovgnji4fu4OQ5zWFkkjWTvYdKZYlcBynUd+I8V6NMwQshR/x+jMqS62GpGq3e8TNjQbt9g73Dzou+clYrVbC8eVyKUqh6ztst9e41S2ouwSqHnEwWH4qlDa2DBRggYPQ34sYBV5llFRIkZTbts2jDdsy4Xuu2HLlckIucmhmjMv7GFd6jBWPupMgFwued7d29I59GLIErz+aePnOwKv3Bl68fcSbCxtlkT3rtCipNIXjy48AF/0An78H+NT18fVnKOrynNPS6EMg58ga+EPUkpB6bTKZ4EHX4bg+DNOCadmwbIc3t8kvjOivG+WsQnJPNvMpTm+Ts4Q0sH73/c/BNngCtACy9VwbJ9QAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 4&quot; title=&quot;3 4&quot; src=&quot;/static/69df1ebaac27a1a999038206b6fe896b/914ae/3-4.png&quot; srcSet=&quot;/static/69df1ebaac27a1a999038206b6fe896b/2eb24/3-4.png 215w,/static/69df1ebaac27a1a999038206b6fe896b/05ed2/3-4.png 430w,/static/69df1ebaac27a1a999038206b6fe896b/914ae/3-4.png 860w,/static/69df1ebaac27a1a999038206b6fe896b/73b94/3-4.png 1004w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:89.76744186046513%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAACXBIWXMAABYlAAAWJQFJUiTwAAADHklEQVQ4y41U224URxDdX8xLXvmU/AMKJMIODxgBAikQKSSRIkS4mNgWAYNs7F3vbM9099z7MrOz9110Ut27Xq/tFx6Oqqu6+sypqu5pvTgeIclKcB5BCIE4jjGdTjGfzzGbza7BxTf3rvqt8WSK0WiE4XCIQTPwdjRc+n49Gvr9c1zEL/sOk8kErfl8Bmst0jRFlmXIihx5USyR5x5lWaLU2iMj36Gg2HmeP5dnaPp9tJzMpmlQZgo6LqBlilLEUDxGKR0Sj4JLFEJ6u/bdPuUpkUCldFbbJWG/7iMUBWJOX6PESDBIyRHKEFxQb2nNRYiQM3AZUZ+lt4zyooQjThOIuITMVoROqqVSdZtBBRzqKIA6i6BPGPRpSGBLdCj2pQfl4u0QhnzDU5iihDUadV2tFPYb8EQhJVSlgnWgJJNm0DmVktLHMkJOMdozitpDPdS01pSnnU/9dbNY95BTySEp7B2fIjg6Ae9SOWcSinqqIrkEkeZuMKWG0gbGXGBNOCdCUw/wx6cK9/4+wcPXPTzY72HnoIv7/3E8Pozx8APHo48CTz6meHma4m0nB0stKqs90SXCBV0bVQ3x6KDCrecd3H7exs6ewta+wN29BE8+xPjtk8CvhwJPDxO8aud431MrhY7wqkIi1PUQjw8sbv3exs2nn7H9IsT2LsfWu4jIUvx1lOB1u8TnSPursVnmtZLXCvcNtv48xr1XDL+8PCWVIXbeh7i7H+Dndx1SKEldjN1Ogn+7OZLC+sleV7jq4UmQIun2kLEYMeMQnQBxJJDSlBN6RYLumqS1oEnLXF0bikNd18spDwYNekzi+EsXgjGE3QCs00XYCxCFDIysiBgqo1BbOmi175/HquwkSfwT9IQ1XeysNCh0BU2yja1Q0ddM1YeuBr4CXdHzNH1C7aHthXXXzpH6kqdEOB7UGDcaw1phUJWoDV1mVSJTDaSeIjVjshPEG8jtxMfKenrpN9b6SkPpZhO86YyxF4yxezbGkZxisVjADewcX69gsWHd//McLWCGO//08d2PCje2Nb7/SeGHZ3adMNlI/hb8DwBYOMMG1VjHAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 5&quot; title=&quot;3 5&quot; src=&quot;/static/96259ba4be52f3098f0aba327a001057/914ae/3-5.png&quot; srcSet=&quot;/static/96259ba4be52f3098f0aba327a001057/2eb24/3-5.png 215w,/static/96259ba4be52f3098f0aba327a001057/05ed2/3-5.png 430w,/static/96259ba4be52f3098f0aba327a001057/914ae/3-5.png 860w,/static/96259ba4be52f3098f0aba327a001057/46115/3-5.png 1290w,/static/96259ba4be52f3098f0aba327a001057/a83dd/3-5.png 1482w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;2-set-up-js-for-firebase&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-set-up-js-for-firebase&quot; aria-label=&quot;2 set up js for firebase permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Set up JS for Firebase&lt;/h2&gt;&lt;h3 id=&quot;first-install-firebase-library-into-your-react-project&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#first-install-firebase-library-into-your-react-project&quot; aria-label=&quot;first install firebase library into your react project permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;First, install firebase library into your React project&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ npm i firebase&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-a-js-file-filebasjs--import-required-libraries-for-db-and-authentication&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-a-js-file-filebasjs--import-required-libraries-for-db-and-authentication&quot; aria-label=&quot;create a js file filebasjs  import required libraries for db and authentication permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create a js file (filebas.js) &amp;amp; import required libraries for db and authentication&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;firebase&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;firebase/app&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;firebase/firestore&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;firebase/auth&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;paste-in-cdn-snippet--initialize&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#paste-in-cdn-snippet--initialize&quot; aria-label=&quot;paste in cdn snippet  initialize permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Paste in CDN snippet &amp;amp; initialize&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; config &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;apiKey&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;AIzaSyBZskQAZgTjfvrhsXG7uLF4catPcYpyc9s&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;authDomain&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;somedb-db.firebaseapp.com&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;databaseURL&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://somedb-db.firebaseio.com&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;projectId&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;somedb-db&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;storageBucket&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;somedb-db.appspot.com&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;messagingSenderId&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;69107290236&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;appId&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;1:69107290236:web:9304b6b56e070e419279f9&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;firebase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;initializeApp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;export-functionalities-to-use-it-elsewhere&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#export-functionalities-to-use-it-elsewhere&quot; aria-label=&quot;export functionalities to use it elsewhere permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Export functionalities to use it elsewhere&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; provide &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;firebase&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;GoogleAuthProvide&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;provider&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setCustomParameters&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;prompt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;select_account&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;signInWithGoogle&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;signInWithPopup&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;provider&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; firebase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; firestore &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; firebase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;firestore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; firebase&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;3-enable-sign-in-method&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-enable-sign-in-method&quot; aria-label=&quot;3 enable sign in method permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Enable sign in method&lt;/h2&gt;&lt;p&gt;On Firebase console, go to &amp;quot;Authentication&amp;quot; and click &amp;quot;Set up sign-in method&amp;quot;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:83.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAABYlAAAWJQFJUiTwAAACe0lEQVQ4y41Ty27TQBT1F7FhhwQfwQaJBQsQC0TFnlU3pTs+AEEl2LBAbJAoolR90EBpUZs4lLR52mmSkthxEr9fsXOYO67dNNCCpaNz77l3zozv2MLGjgjC1/0SNr6J+LL3Eytbe9gVyxgZNjw/hOP6cL2Ag+LLIPT6I/QHOrrqEIp2xqSblps12o5/zvgiCMf9ABZr7qojbtT6pbHcw1C3IbcVqAMDuumg2VG5/q9TCi3Vg2F7MG0XFuMMDmkJJ7HLTunxk14GIQgCNqcAPpuVdwr/HAeZnsT0av6FEEzThGVZIDYMg7Ou61mc1ogJjuMgDMMMdCDCeDxmB2CGruvyRmLP8zjSmBYTUp36iMkoraeGFNPGgm3bGAwG2S7ToBqZUEx16iOjKIq4rmka12kDVVWhKAoETD2TyYQjjhOe1afzi2rCtDBd4PmM8f88wqxZwNBoWQjMMNPpFZNZJRcxZnl6KVRLR0S5MG021gOsLP7A/KNt5B7uoLPT57rSU3B0WIIsNVCrVSExbsoSatUyQxX1eh2NRgOyLCeGcZQYll9LWLq5iYX5PJ7eymH5Tg6xP8FwpOOoKrO/RcFx6wSS3ILc6qIud9BottHt9tDr9c4uJTX8/kTE88cF3H+1hRfPCvh4Oweb/UlUdSLACM9mZbOclTByZ2aYDp8eabWN9YUCXr5fxoc32xCXKrQdTnb3kV/Po7hVRGFTROGziOJmHkGtzNfFcZzddjbDCRJTTRpCbOqoNocI/Ygmi8X5t7hydxU35tZx7cEars9t4Oq9Tyi+W+NrImaY+gh//55OG5ICnHoN6sERtMMK+qUyQwXawSHG3c4fn9tvnhsGJYI2K+8AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 6&quot; title=&quot;3 6&quot; src=&quot;/static/1ec58b6adada23d42799f0d9c7dc29a3/914ae/3-6.png&quot; srcSet=&quot;/static/1ec58b6adada23d42799f0d9c7dc29a3/2eb24/3-6.png 215w,/static/1ec58b6adada23d42799f0d9c7dc29a3/05ed2/3-6.png 430w,/static/1ec58b6adada23d42799f0d9c7dc29a3/914ae/3-6.png 860w,/static/1ec58b6adada23d42799f0d9c7dc29a3/1628f/3-6.png 1232w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Then, enable sign-in methods for Google and for Email/Password.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:48.37209302325581%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAABCklEQVQoz5VS2W6DMBD0/39iGzVNJQIBBPi+MNO1gSh5aElWGqGx95gdw06XGpeqw8f5is/vGlJZGOuhjSP4A7iSW/LtesYmITFOAlwoKG3okBqWxNeQa4RUax1xprVG0zQQnGNJCTHGAu/9IUIIpe5WXeGMKZx1XYu6rkmVgZQSStE0GpKo+RGyAEvDO2fAgyuc9X1fFFprnxouy4Ic+fsXctg0ow0WPIbCWb5I26qP8V+jR6R5RqJVE9VnzpwnH0gZJy+yL3uzo9hzcs0wDBBCbAq1RKSXSkSKLy8quyskRMK8cfLwB+eqxTSO9A+qt9bNIcm7Ly1wo4cpCrMyun7bu3vT3Z5lrf0FKHUPyyDuhzsAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 7&quot; title=&quot;3 7&quot; src=&quot;/static/97a71dc0a537fe776ae2eafdcda8d998/914ae/3-7.png&quot; srcSet=&quot;/static/97a71dc0a537fe776ae2eafdcda8d998/2eb24/3-7.png 215w,/static/97a71dc0a537fe776ae2eafdcda8d998/05ed2/3-7.png 430w,/static/97a71dc0a537fe776ae2eafdcda8d998/914ae/3-7.png 860w,/static/97a71dc0a537fe776ae2eafdcda8d998/966a0/3-7.png 944w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Note: Enabling &amp;quot;Email link&amp;quot; will require user to verify their email address.&lt;/p&gt;&lt;h2 id=&quot;4-create-sign-in-with-google&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-create-sign-in-with-google&quot; aria-label=&quot;4 create sign in with google permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Create Sign in with Google&lt;/h2&gt;&lt;p&gt;Let&amp;#x27;s create sign in with Google function before we implement our own sign up and sign in.&lt;/p&gt;&lt;h3 id=&quot;import&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#import&quot; aria-label=&quot;import permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Import&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; signInWithGoogle &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/firebase/firebase.js&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-button-for-pop-up&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-button-for-pop-up&quot; aria-label=&quot;create button for pop up permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create button for pop up&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;signInWithGoogle&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; Sign in with Google &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point, the page is aware that there is an user &lt;strong&gt;authentication&lt;/strong&gt; (We still need to store auth data to our db in later step).&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:47.906976744186046%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAABXElEQVQoz41Qy0oDQRCcLxX8Kw/qpwSFoIKiHqK5eFFQ83B3Mjuv3dlH2TVhY4IgNhRdXdNdvb1qejfD9HaGm4dnXN0/YXL9iPnLG2KdEGKzgw/1v6A2lce6MCg2FivJ2jgU2oI6G4wNsD4emP8FVZgai7XGx0rjfVGgEoNP4a8f62xG7UtXudn5+jdkaeW4WCBZ+dDk80ZwkLlufvhfJ9MUXQNgC+V9kIeInPcQqIWQQR5iRF03WzTbHAVDl3Ax9ziZGJxdGihjDKqqgrU2Y6xHOGclm/yWUkKTzerMaYguitkGR6cFjs8LqLIsEWV713Vo2zYjSaMTY+qsucQ5lzmNy1JnQ+89lsslvDNA3wJDC8UHBrdyiBFDhVLrzPu+l5NDNh/7WDO4gDNWMF6kODAMw+4LM+87JNGl2L0RDGaezd593qSU/61iE4fG+GGH+r7Gr+W5NBsvpE7+Df3VA7hr2g3+AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 8&quot; title=&quot;3 8&quot; src=&quot;/static/cd8132977048ff989167051acb2f0482/914ae/3-8.png&quot; srcSet=&quot;/static/cd8132977048ff989167051acb2f0482/2eb24/3-8.png 215w,/static/cd8132977048ff989167051acb2f0482/05ed2/3-8.png 430w,/static/cd8132977048ff989167051acb2f0482/914ae/3-8.png 860w,/static/cd8132977048ff989167051acb2f0482/46115/3-8.png 1290w,/static/cd8132977048ff989167051acb2f0482/e40ed/3-8.png 1378w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;5-add-sign-out-functionality&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-add-sign-out-functionality&quot; aria-label=&quot;5 add sign out functionality permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Add sign out functionality&lt;/h2&gt;&lt;p&gt;In &lt;em&gt;App.js&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; auth &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/firebase/firebase.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  undoAuth &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword null nil&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;undoAuth&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;onAuthStateChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// console.log(user);///&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Handle Auth changes&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentWillUnmount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;undoAuth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In &lt;em&gt;Header.jsx&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-router-dom&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; auth &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../../firebase/firebase.utils&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; curUser &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;header-items&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;curUser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//   When logged in, display sign out&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;signOut&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          SIGN OUT&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//   When user need to log in&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/signin&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          SIGN IN&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Header&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;6-store-user-authentication-into-db&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#6-store-user-authentication-into-db&quot; aria-label=&quot;6 store user authentication into db permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;6. Store user authentication into db&lt;/h2&gt;&lt;p&gt;We still need to store user authentication into our database (Firestore).&lt;/p&gt;&lt;h3 id=&quot;create-firestoredb-in-firebase&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-firestoredb-in-firebase&quot; aria-label=&quot;create firestoredb in firebase permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create Firestore(db) in Firebase&lt;/h3&gt;&lt;p&gt;On Firebase console, go to &amp;quot;Cloud Firestore&amp;quot; or &amp;quot;Database&amp;quot;. Then, create database in test mode&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:838px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:77.20930232558139%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAABYlAAAWJQFJUiTwAAACS0lEQVQ4y6WUS2tTQRiG5xwCKsVWxYVEanqJpqGovYCoC7euXEgRcdWdiK1t2qTmJG1s0tLcm4hrFUEtIgguvSzEH+D/EDfJzJyJUaiv35xJiJgILQYevlzg4X3nmxPG14dRj/WhHj0EkRmF2CAyAYjEAPiKDyLKIGIWxAqDvE/ENRZch0gwuEkGpVkl1hhY7R6Dpr5ooR6xUV+ywZct8KhBxJhh38IFLSUiDHyJWCba6f5PaJmEXsp2XYMRWvsRWp2UXkLbnGGLjpBEDvtDaPUSWp6Uxw6AO/1GuNhKmOyDTA0Yoa6u0zkdqUlo9VgKTfnoCuST61Cv70A9uwG1M0tzBurNHNTTa1AvbqHxahbf386j8XwGjZc3odKHjTRl90io0637IbaCEMVxiHwIYrUf8sFRyPRxyGIIbm4Ibolm1g+3EDAyOgaV6FU5fQp86wzE5hBEmsRrJMoFIQshyE0/SY+RMAA3T9LiCFT2JFT5NFRlDKoa7q7MMySqXoYonYcoT0IUxiGr03QUl2hOQeZHPLyEuUESD5IsDFUaJnHwr4RtYXmaRGdJfIFmmGqPQVYmSHqRqh+BpIW5tByXluTGW3WdrsqtlPM07xJzJNfQZ06/iQXzxMi4TVu2absa2rZ3ZWzasMbqTihSJyC3p+BuTxgqk3CrROUcZPKguTrOXi52xIfabYafX3agX7v8G341OHbrX817+q7x+CoE3U2Z8O3lz8FGjarqu9f8/BDNdxk0P2bR/LCB5vsMfnwq0gJGIfUToyv/Q/gby1z1Le2Z3lEAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 9&quot; title=&quot;3 9&quot; src=&quot;/static/32874112e6825f258aaac5c3fd12b607/a1dd2/3-9.png&quot; srcSet=&quot;/static/32874112e6825f258aaac5c3fd12b607/2eb24/3-9.png 215w,/static/32874112e6825f258aaac5c3fd12b607/05ed2/3-9.png 430w,/static/32874112e6825f258aaac5c3fd12b607/a1dd2/3-9.png 838w&quot; sizes=&quot;(max-width: 838px) 100vw, 838px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:63.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAABYlAAAWJQFJUiTwAAACTUlEQVQ4y12Ry24TQRBFZw3ZIIEEIglSPoAFYoX4HwTZIHACO6Qs4CvYsCUQ+IQEISCIV5AQieO3PdM97Xn2PDyeiS5VbY+xsji6t6vLd6rc1t0XCrd3XNx5rnDzmcRqQ2B9S5A6WCPYL7PWOIfpFbixLbDxRMC6taNw5aHAtcccJrHx1MXVRxIrmw4ubQ5wvTGrr25JrG9LXKbeC/dtrDywcXFO7blu7X0NsHfo4+1hgDdffCIwvP7sEf6CXbrbnft33zTef08IfY4EVhRraK2BKgPOUlKipPM0Jp/MKGvVM4+SqJa0WpytkfThuD5GjoRwFYIwRlFWyPICfhDBC0LS0NTDSCOkAdjXcE9NFNOESrnodjvodDro9Xro9/tIkgR5nlO9a+r1HTMcDuE4DmzbNiqlhOu6RoMgoJWjCHEcI01TE8TKYQw3ctjp6SmazaZRPteBQgjTo5QyGoYhrL7jQQoHPZqMCxw0nU6RZRnG1Mg/brVaFHhiAnnqdru1mL5HylOPRqNZoO97GAwG5otcZM8Tc7Ajx5DKg/J8qLE/Vw8uo5aUkGpMK1MgvzDvzumsHFYUBSaTCWL7DyKniVB0ETrt/9ithUbzWmC3oSMPVlmWqKoKy8orT6cFID+i7BwgP/6A/O++YXK8j8r+gTNxRPoTlXNE/hcQ/AYKF1b9EPyfLaB1szQhNFIdIA3HSKMxstg3mqeRocgTlBONmDI+HYc4GWlY/Nye55kX5vWZmZ+fySdpRpouSIiY7rN8Qh+M0BYJ7r0K8fJA4x8g+JmbYDD+pwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3 10&quot; title=&quot;3 10&quot; src=&quot;/static/625e70ad172aaadf59f0e628c6aa9aff/914ae/3-10.png&quot; srcSet=&quot;/static/625e70ad172aaadf59f0e628c6aa9aff/2eb24/3-10.png 215w,/static/625e70ad172aaadf59f0e628c6aa9aff/05ed2/3-10.png 430w,/static/625e70ad172aaadf59f0e628c6aa9aff/914ae/3-10.png 860w,/static/625e70ad172aaadf59f0e628c6aa9aff/46115/3-10.png 1290w,/static/625e70ad172aaadf59f0e628c6aa9aff/0ef7e/3-10.png 1594w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;side-note-getting-user-reference&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#side-note-getting-user-reference&quot; aria-label=&quot;side note getting user reference permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Side note: Getting user reference&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;firebase&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;firebase/app&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;firebase/firestore&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; firestore &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; firebase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;firestore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Examples of retrieving collections or docs&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;firestore&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;collection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;doc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SAh79TtKh7PBjp4kFglWb8yysXl1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;collection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;someItems&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;doc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Qo0eUBTNla84Zh1BDs78&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// is equivalent to..&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;firestore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;doc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;users/SAh79TtKh7PBjp4kFglWb8yysXl1/someItems/Qo0eUBTNla84Zh1BDs78&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Getting collection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;firestore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;collection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;users/SAh79TtKh7PBjp4kFglWb8yysXl1/someItems/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;in-firebasejs-create-async-api-request-to-store-data-into-db&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#in-firebasejs-create-async-api-request-to-store-data-into-db&quot; aria-label=&quot;in firebasejs create async api request to store data into db permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;In &lt;em&gt;firebase.js&lt;/em&gt;, create async API request to store data into db&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;createUserData&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; moreData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// When there is no authentication&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Get snap shot of user reference from the particular user in users collection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ref &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; firestore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;doc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;users/&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token template-string interpolation property-access&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; snapShot &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ref&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// If the snap shot info is not in db, create one&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;snapShot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;exists&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; displayName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; email &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userAuth&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; createdAt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// store into database&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ref&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        displayName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        createdAt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;moreData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Error creating user&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Return user reference&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ref&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;call-the-implemented-function-in-componentdidmount-in-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#call-the-implemented-function-in-componentdidmount-in-appjs&quot; aria-label=&quot;call the implemented function in componentdidmount in appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Call the implemented function in componentDidMount in &lt;em&gt;App.js&lt;/em&gt;&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; createUserData &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/firebase/firebase.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;undoAuth&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;onAuthStateChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createUserData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Above function stores the user data in to database. Next step now is to &lt;strong&gt;store the data as state&lt;/strong&gt; of our app.&lt;/p&gt;&lt;h2 id=&quot;7-store-data-from-db-as-state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#7-store-data-from-db-as-state&quot; aria-label=&quot;7 store data from db as state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;7. Store data from db as state&lt;/h2&gt;&lt;p&gt;Make the following changes in &lt;em&gt;App.js&lt;/em&gt; to store data from db as state.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;undoAuth&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;onAuthStateChanged&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Use ref to retrieve data by onSnapshot method&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ref &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createUserData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;userAuth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Grab data in db&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        ref&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;onSnapshot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;snapShot&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; snap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;snapShot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;              &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//, () =&amp;gt; {&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//   console.log(this.state); /// debug&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// }&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// On sign out, change curUser to null&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;curUser&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; userAuth &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;8-create-sign-up-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#8-create-sign-up-component&quot; aria-label=&quot;8 create sign up component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;8. Create Sign up component&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; createUserData &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/firebase/firebase.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;SignUp&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;displayName&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;passwordConfirm&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; displayName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; password&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; passwordConfirm &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;password &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; passwordConfirm&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;passwords don&amp;#x27;t match&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// authenticate &amp;amp; create user data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; user &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createUserWithEmailAndPassword&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        password&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createUserData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; displayName &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Action after form submission (clear form)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;displayName&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;passwordConfirm&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; value &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; value &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; displayName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; password&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; passwordConfirm &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;sign-up&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Sign up&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Sign up with your email and password&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;sign-up-form&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;displayName&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;displayName&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Display Name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;passwordConfirm&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;passwordConfirm&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Confirm Password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;SIGN UP&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;SignUp&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;9-create-sign-in-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#9-create-sign-in-component&quot; aria-label=&quot;9 create sign in component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;9. Create sign in component&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; signInWithGoogle &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../../firebase/firebase.utils&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;SignIn&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; password &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auth&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;signInWithEmailAndPassword&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; password&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// After logging in&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; event&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; value &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;sign-in&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Login&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Sign in with your email and password&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleSubmit&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;buttons&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; Sign in &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;signInWithGoogle&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Sign in with Google&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;SignIn&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Git]: Commonly used git commands]]></title><description><![CDATA[Basic git commands add add all modified files commit with commit message add all modified files & commit add remote repository push on a…]]></description><link>https://ellismin.com/2019/11/git-commands/</link><guid isPermaLink="false">https://ellismin.com/2019/11/git-commands/</guid><pubDate>Thu, 07 Nov 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;basic-git-commands&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#basic-git-commands&quot; aria-label=&quot;basic git commands permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Basic git commands&lt;/h2&gt;&lt;h3 id=&quot;add&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add&quot; aria-label=&quot;add permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;add&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git add ${file name}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-all-modified-files&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-all-modified-files&quot; aria-label=&quot;add all modified files permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;add all modified files&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git add .&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;commit-with-commit-message&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#commit-with-commit-message&quot; aria-label=&quot;commit with commit message permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;commit with commit message&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git commit -m &amp;quot;${commit message}&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-all-modified-files--commit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-all-modified-files--commit&quot; aria-label=&quot;add all modified files  commit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;add all modified files &amp;amp; commit&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git commit -am &amp;quot;${commit message}&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-remote-repository&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-remote-repository&quot; aria-label=&quot;add remote repository permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;add remote repository&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git remote add ${github remote repo address}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;push-on-a-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#push-on-a-branch&quot; aria-label=&quot;push on a branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;push on a branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git push origin ${branch name}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-a-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-a-branch&quot; aria-label=&quot;create a branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;create a branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git checkout -b ${branch name}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;move-to-different-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#move-to-different-branch&quot; aria-label=&quot;move to different branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;move to different branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git checkout ${branch name}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;change-name-of-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#change-name-of-branch&quot; aria-label=&quot;change name of branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;change name of branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git branch -M ${new branch name}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;display-state-of-working-directory&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#display-state-of-working-directory&quot; aria-label=&quot;display state of working directory permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;display state of working directory&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git status&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;see-differences-with-last-commit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#see-differences-with-last-commit&quot; aria-label=&quot;see differences with last commit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;see differences with last commit&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git diff&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;display-commits-made-in-the-repo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#display-commits-made-in-the-repo&quot; aria-label=&quot;display commits made in the repo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;display commits made in the repo&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git log&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;more information on &lt;a href=&quot;/2019/09/git-log/&quot;&gt;this post&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;show-commit-log-in-a-graph&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#show-commit-log-in-a-graph&quot; aria-label=&quot;show commit log in a graph permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;show commit log in a graph&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git log --graph&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;more-commands&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-commands&quot; aria-label=&quot;more commands permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More commands&lt;/h2&gt;&lt;h3 id=&quot;revert-a-modified-file&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#revert-a-modified-file&quot; aria-label=&quot;revert a modified file permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;revert a modified file&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git checkout -- ${filename}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;change-the-most-recent-commit-message&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#change-the-most-recent-commit-message&quot; aria-label=&quot;change the most recent commit message permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;change the most recent commit message&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git commit --amend&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;When changing the most recent commit message that&amp;#x27;s already&lt;/em&gt; &lt;strong&gt;&lt;em&gt;pushed&lt;/em&gt;&lt;/strong&gt;, &lt;em&gt;use the following&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git push --force-with-lease ${repository} ${branch}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;${repository} and ${branch} are optional&lt;/em&gt;&lt;/p&gt;&lt;h3 id=&quot;change-old-commit-message&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#change-old-commit-message&quot; aria-label=&quot;change old commit message permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;change old commit message&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git rebase -i HEAD~${#commits to go back}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;For example, HEAD~2 is the second last commit. It will display a list of the last 2 commit messages; bottom displays the most recent commit&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;pick 86fbdbe modified post # 2nd MOST RECENT COMMIT&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;pick f4683d1 modified post # MOST RECENT COMMIT&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;# ...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;Replace pick with reword then save &amp;amp; quit&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;reword 86fbdbe modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;pick f4683d1 modified post&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;It will open up the editor to change the specified commit with &amp;quot;reword&amp;quot;. Modify the message then save&amp;amp;quit. Push with the following&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git push --force-with-lease ${repository} ${branch}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;revert-the-most-recent-commit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#revert-the-most-recent-commit&quot; aria-label=&quot;revert the most recent commit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;revert the most recent commit&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git revert HEAD&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;OR&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git reset HEAD^&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;more information on &lt;a href=&quot;/2019/09/git-reset/&quot;&gt;this post&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;add-remote-repo-as-upstream-on-local-repo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-remote-repo-as-upstream-on-local-repo&quot; aria-label=&quot;add remote repo as upstream on local repo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;add remote repo as upstream on local repo&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git remote add --track master upstream ${github repo remote address}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;update-master-branch-to-the-latest-version-of-upstream&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#update-master-branch-to-the-latest-version-of-upstream&quot; aria-label=&quot;update master branch to the latest version of upstream permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;update master branch to the latest version of upstream&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git pull --ff upstream master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;combine-multiple-commits&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#combine-multiple-commits&quot; aria-label=&quot;combine multiple commits permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;combine multiple commits&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git rebase -i HEAD~${number of commits}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;display-git-history&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#display-git-history&quot; aria-label=&quot;display git history permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;display git history&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git reflog&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-the-modified-file-to-the-most-recent-commit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-the-modified-file-to-the-most-recent-commit&quot; aria-label=&quot;add the modified file to the most recent commit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;add the modified file to the most recent commit&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git commit -C HEAD --amend&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;ignore-the-modified-file-from-the-stage&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#ignore-the-modified-file-from-the-stage&quot; aria-label=&quot;ignore the modified file from the stage permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ignore the modified file from the stage&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git update-index --assume-unchanged ${file name}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;staging area is a step before the commit process.&lt;/em&gt;&lt;/p&gt;&lt;h3 id=&quot;revert-ignoring-the-modified-file-from-the-stage&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#revert-ignoring-the-modified-file-from-the-stage&quot; aria-label=&quot;revert ignoring the modified file from the stage permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;revert ignoring the modified file from the stage&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git update-index --no-assume-unchanged ${file name}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;stash-the-changes-in-dirty-working-directory-away&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#stash-the-changes-in-dirty-working-directory-away&quot; aria-label=&quot;stash the changes in dirty working directory away permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;stash the changes in dirty working directory away&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git stash&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;i.e. record the current state of working directory without local modification on current branch&lt;/em&gt;&lt;/p&gt;&lt;h3 id=&quot;remove-a-single-stashed-state-and-apply-it-on-the-current-working-state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#remove-a-single-stashed-state-and-apply-it-on-the-current-working-state&quot; aria-label=&quot;remove a single stashed state and apply it on the current working state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;remove a single stashed state and apply it on the current working state&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git pop&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;pick-particular-commit-and-merge-it-from-other-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#pick-particular-commit-and-merge-it-from-other-branch&quot; aria-label=&quot;pick particular commit and merge it from other branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;pick particular commit and merge it from other branch&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git cherry-pick ${commit hash number}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;remove-upstream&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#remove-upstream&quot; aria-label=&quot;remove upstream permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;remove upstream&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git branch --unset-upstream&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React]: Router with React Router DOM]]></title><description><![CDATA[More information on React Router DOM can be found  here . 1. Install React Router DOM 2. Add Browser Router in index.js Import Browser…]]></description><link>https://ellismin.com/2019/11/react-router/</link><guid isPermaLink="false">https://ellismin.com/2019/11/react-router/</guid><pubDate>Wed, 06 Nov 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;More information on React Router DOM can be found &lt;a href=&quot;https://reacttraining.com/react-router/web/guides/quick-start&quot; target=&quot;_black&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;h2 id=&quot;1-install-react-router-dom&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-install-react-router-dom&quot; aria-label=&quot;1 install react router dom permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Install React Router DOM&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i react-router-dom&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;2-add-browser-router-in-indexjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-add-browser-router-in-indexjs&quot; aria-label=&quot;2 add browser router in indexjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Add Browser Router in index.js&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;BrowserRouter&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-router-dom&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;BrowserRouter&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;BrowserRouter&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Import Browser Router component and wrap it around the App component.&lt;/p&gt;&lt;h2 id=&quot;3-create-route-in-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-create-route-in-appjs&quot; aria-label=&quot;3 create route in appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Create Route in App.js&lt;/h2&gt;&lt;h3 id=&quot;import-route&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#import-route&quot; aria-label=&quot;import route permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Import Route&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-router-dom&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-another-page&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-another-page&quot; aria-label=&quot;create another page permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create another page&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;MainPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;MAIN PAGE&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;SECOND PAGE&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-route&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-route&quot; aria-label=&quot;create route permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create route&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;MainPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;page2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note: If you don&amp;#x27;t put &lt;em&gt;exact&lt;/em&gt;, it will be rendered in different pages as well which includes the same path.&lt;/p&gt;&lt;p&gt;For example, if you would like to include a navigation bar in all the pages exclude &lt;em&gt;exact&lt;/em&gt; tag.&lt;/p&gt;&lt;h2 id=&quot;4-using-switch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-using-switch&quot; aria-label=&quot;4 using switch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Using Switch&lt;/h2&gt;&lt;p&gt;Using Switch component prevents from rendering other pages.&lt;/p&gt;&lt;h3 id=&quot;import-switch-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#import-switch-component&quot; aria-label=&quot;import switch component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;import Switch Component&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Switch&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-router-dom&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;usage&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#usage&quot; aria-label=&quot;usage permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Switch&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;MainPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/page2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Switch&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When a Route is found inside Switch tag, it won&amp;#x27;t render anything else.&lt;/p&gt;&lt;p&gt;For example, when we have&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Switch&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;MainPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/page2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Switch&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, we go to &lt;em&gt;/page2&lt;/em&gt;, it will only show MainPage since MainPage will be rendered and it doesn&amp;#x27;t render others.&lt;/p&gt;&lt;h2 id=&quot;creating-dynamic-routing&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#creating-dynamic-routing&quot; aria-label=&quot;creating dynamic routing permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating Dynamic routing&lt;/h2&gt;&lt;h3 id=&quot;nested-routes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#nested-routes&quot; aria-label=&quot;nested routes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Nested routes&lt;/h3&gt;&lt;p&gt;Creating nested routes is possible with the following.&lt;/p&gt;&lt;p&gt;First, create more sub page&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;SubPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;SUB PAGE&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;MainPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/page2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/page2:pageId&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SubPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;:pageId&lt;/em&gt; is a &lt;strong&gt;URL parameter&lt;/strong&gt;. It shows the pages that match dynamically. For example, it will show the SubPage for any url: &lt;em&gt;/page2/*&lt;/em&gt;&lt;/p&gt;&lt;h3 id=&quot;props-components&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#props-components&quot; aria-label=&quot;props components permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;props components&lt;/h3&gt;&lt;p&gt;props has different components:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;props.match&lt;/li&gt;&lt;li&gt;props.history&lt;/li&gt;&lt;li&gt;props.location&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;We can show which url that&amp;#x27;s visited with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;SubPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;SUB&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PAGE&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;pageId&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For example, when we visit&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;localhost:3000/page2/asdfasdf&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will show on page:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;SUB PAGE: asdfasdf&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This allows the sub page to populate itself. This may be useful to retrieve data from back end.&lt;/p&gt;&lt;h2 id=&quot;link-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#link-component&quot; aria-label=&quot;link component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Link Component&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-router-dom&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/page2/100&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;To Sub Page 100&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;SECOND PAGE&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note: React is SPA. This does not &lt;strong&gt;redirect&lt;/strong&gt; and &lt;strong&gt;rebuild&lt;/strong&gt; the entire application, but rather, it determines which part of the DOM to use.&lt;/p&gt;&lt;p&gt;This would be similar to using:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; props&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;history&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;/asdf&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By using a props component it&amp;#x27;d be more efficient to use it as:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt;/100&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;TO SUB PAGE 100&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt;/222&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;TO SUB PAGE 222&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt;/7&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;TO SUB PAGE 7&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;SECOND PAGE&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is useful when you want to &lt;strong&gt;re-use&lt;/strong&gt; sub page that isn&amp;#x27;t from &lt;em&gt;page2&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;For example:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;MainPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/page2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/page2:pageId&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SubPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;exact&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/asd/asd&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SecondPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Route&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/asd/asd/:pageId&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript maybe-class-name&quot;&gt;SubPage&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;SecondPage and SubPage components can be re-used in different links in &lt;em&gt;/asd/asd&lt;/em&gt;.&lt;/p&gt;&lt;h2 id=&quot;withrouter&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#withrouter&quot; aria-label=&quot;withrouter permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;withRouter&lt;/h2&gt;&lt;p&gt;As we&amp;#x27;ve imported React &lt;em&gt;Route&lt;/em&gt; in our app class, in order for sub-component to use it, it would have to pass down &lt;em&gt;props.history&lt;/em&gt;. However, there may be situation where you have to pass down the &lt;em&gt;props.history&lt;/em&gt; multiple times--this inefficiency is called &lt;strong&gt;prop tunneling/drilling&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;To prevent this, in the children that needs props.history, use the component &lt;strong&gt;withRouter&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;usage-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#usage-1&quot; aria-label=&quot;usage 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; withRouter &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-router-dom&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;withRouter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ChildComponent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;withRouter&lt;/strong&gt; is a higher order component, function that takes any component as argument and returns a modified component.&lt;/p&gt;&lt;p&gt;i.e. the child component gets access to props.history&lt;/p&gt;&lt;p&gt;In the child component, access with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; history&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React]: Lifecycle Methods in React]]></title><description><![CDATA[Lifecycle Method Lifecycle methods are series of events happening from the birth of React component to its end. You can think of it as three…]]></description><link>https://ellismin.com/2019/11/react-lifecycle/</link><guid isPermaLink="false">https://ellismin.com/2019/11/react-lifecycle/</guid><pubDate>Tue, 05 Nov 2019 00:00:02 GMT</pubDate><content:encoded>&lt;h2 id=&quot;lifecycle-method&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#lifecycle-method&quot; aria-label=&quot;lifecycle method permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Lifecycle Method&lt;/h2&gt;&lt;p&gt;Lifecycle methods are series of events happening from the birth of React component to its end.&lt;/p&gt;&lt;p&gt;You can think of it as three states:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Mounting (&lt;strong&gt;Birth&lt;/strong&gt; of component)&lt;/li&gt;&lt;li&gt;Update (&lt;strong&gt;Growth&lt;/strong&gt; of component)&lt;/li&gt;&lt;li&gt;Unmount (&lt;strong&gt;Death&lt;/strong&gt; of component)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Lifecycle diagram available from &lt;a href=&quot;http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;h2 id=&quot;mounting&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#mounting&quot; aria-label=&quot;mounting permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Mounting&lt;/h2&gt;&lt;p&gt;Mounting phase is when component is put on DOM for the first time. It starts before when our component is in our DOM.&lt;/p&gt;&lt;p&gt;It looks at the life cycle component then calls:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;constructor()&lt;/li&gt;&lt;li&gt;render()&lt;/li&gt;&lt;li&gt;componentDidMount()&lt;/li&gt;&lt;/ol&gt;&lt;h3 id=&quot;render&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#render&quot; aria-label=&quot;render permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;render()&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Most used lifecycle method&lt;/li&gt;&lt;li&gt;Renders JSX component to the UI&lt;/li&gt;&lt;li&gt;Happens during &lt;strong&gt;mounting&lt;/strong&gt; and &lt;strong&gt;updating&lt;/strong&gt; phases&lt;/li&gt;&lt;li&gt;render() has to return the same output when same inputs are passed&lt;ul&gt;&lt;li&gt;i.e. don&amp;#x27;t put &lt;em&gt;setState()&lt;/em&gt; in &lt;em&gt;render()&lt;/em&gt;. You shouldn&amp;#x27;t change the state in &lt;em&gt;render()&lt;/em&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;componentdidmount&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#componentdidmount&quot; aria-label=&quot;componentdidmount permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;componentDidMount()&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Gets called right after component is mounted&lt;/li&gt;&lt;li&gt;Good place to start API calls to load the data&lt;/li&gt;&lt;li&gt;Allows &lt;em&gt;setState()&lt;/em&gt; which update state and render(), but it happens before browser updates the UI, so that viewer can&amp;#x27;t see undesired UI updates.&lt;/li&gt;&lt;li&gt;Ensure that states are assigned in the &lt;em&gt;constructor()&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Use of &lt;em&gt;setState()&lt;/em&gt; in here is to allow special cases: tooltips, modals, etc&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;updating&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#updating&quot; aria-label=&quot;updating permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Updating&lt;/h2&gt;&lt;h3 id=&quot;componentdidupdate&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#componentdidupdate&quot; aria-label=&quot;componentdidupdate permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;componentDidUpdate()&lt;/h3&gt;&lt;p&gt;Invoked right &lt;strong&gt;after&lt;/strong&gt; update happens. This updates DOM based on state/prop change.&lt;/p&gt;&lt;p&gt;&lt;em&gt;setState()&lt;/em&gt; is allowed but pass in &lt;em&gt;prevProps&lt;/em&gt; to prevent infinite loop.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;componentDidUpdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;prevProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; prev&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access maybe-class-name&quot;&gt;Props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;fetchData&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This ensures not to make API call when there props did not change.&lt;/p&gt;&lt;h3 id=&quot;shouldcomponentupdate&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#shouldcomponentupdate&quot; aria-label=&quot;shouldcomponentupdate permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;shouldComponentUpdate()&lt;/h3&gt;&lt;p&gt;Called when you want React not to re-render for particular state/prop changes.&lt;/p&gt;&lt;p&gt;Should only be used for optimizing performance.&lt;/p&gt;&lt;p&gt;When returns false, it discontinues the lifecycle methods.&lt;/p&gt;&lt;h2 id=&quot;unmounting&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#unmounting&quot; aria-label=&quot;unmounting permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Unmounting&lt;/h2&gt;&lt;h3 id=&quot;componentwillunmount&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#componentwillunmount&quot; aria-label=&quot;componentwillunmount permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;componentWillUnmount()&lt;/h3&gt;&lt;p&gt;Called right &lt;strong&gt;before&lt;/strong&gt; component gets destroyed. This is a good place to do clean ups to prevent memory leak.&lt;/p&gt;&lt;p&gt;You can&amp;#x27;t modify state here.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[React]: setState (Asynchronous)]]></title><description><![CDATA[Previously on setState() In  [React]: Basics , we've seen that  setState()  is a  asynchronous  function which does not happen immediately…]]></description><link>https://ellismin.com/2019/11/react-setstate/</link><guid isPermaLink="false">https://ellismin.com/2019/11/react-setstate/</guid><pubDate>Tue, 05 Nov 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;previously-on-setstate&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#previously-on-setstate&quot; aria-label=&quot;previously on setstate permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Previously on setState()&lt;/h2&gt;&lt;p&gt;In &lt;a href=&quot;/2019/10/react-basics/#adding-search-box&quot;&gt;[React]: Basics&lt;/a&gt;, we&amp;#x27;ve seen that &lt;em&gt;setState()&lt;/em&gt; is a &lt;strong&gt;asynchronous&lt;/strong&gt; function which does not happen immediately, but rather, happens in the future. Consider below situation where a button updates a value of state.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Update state&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleClick&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since &lt;em&gt;setState()&lt;/em&gt; is &lt;strong&gt;asynchronous&lt;/strong&gt;, the value doesn&amp;#x27;t get updated immediately on the console.&lt;/p&gt;&lt;p&gt;When using &lt;em&gt;setState()&lt;/em&gt;, we give control to React library which figures out how to optimally update the state--React &lt;strong&gt;batches&lt;/strong&gt; work into single update.&lt;/p&gt;&lt;p&gt;We&amp;#x27;ve previously got around this by using a callback:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleClick&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, this is a &lt;strong&gt;bad practice&lt;/strong&gt;. Having multiple &lt;em&gt;setState()&lt;/em&gt;, won&amp;#x27;t guarantee that the new state variable is the latest version.&lt;/p&gt;&lt;p&gt;Rule of thumb is not to use &lt;em&gt;this.state&lt;/em&gt; inside &lt;em&gt;setState()&lt;/em&gt;, but instead, &lt;strong&gt;create a function&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;what-you-should-do&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-you-should-do&quot; aria-label=&quot;what you should do permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What you should do&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleClick&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;prevState&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; prevProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; prevState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This uses a function instead of an object, and using a parameter &lt;em&gt;prevState&lt;/em&gt; will give the &lt;strong&gt;latest value&lt;/strong&gt; for update.&lt;/p&gt;&lt;p&gt;When you somehow need to manipulate state &lt;strong&gt;after&lt;/strong&gt; the update, add into second parameter where the callback function is.&lt;/p&gt;&lt;p&gt;How about &lt;em&gt;prevProps&lt;/em&gt;?&lt;/p&gt;&lt;p&gt;Here is how to pass down props onto &lt;em&gt;App&lt;/em&gt; in &lt;em&gt;index.js&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;increment&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, use call it with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleClick&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;prevState&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; prevProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; prevState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; prevProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;increment&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;using-props-in-constructor&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#using-props-in-constructor&quot; aria-label=&quot;using props in constructor permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using props in constructor&lt;/h2&gt;&lt;p&gt;You can also pass in props into constructor&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Allows to use props in constructor like&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;increment&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By doing so, &lt;em&gt;someVal&lt;/em&gt; will originally hold &lt;strong&gt;35&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;alternate-class-syntax&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#alternate-class-syntax&quot; aria-label=&quot;alternate class syntax permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Alternate Class Syntax&lt;/h2&gt;&lt;p&gt;Create React App allows Alternate Class Syntax which isn&amp;#x27;t allowed in the current JavaScript.&lt;/p&gt;&lt;p&gt;Example: Remove the &lt;em&gt;constructor&lt;/em&gt; and just have &lt;em&gt;state&lt;/em&gt; variable.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  state &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someVal&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This initialize &lt;em&gt;state&lt;/em&gt; as &lt;strong&gt;class field declaration&lt;/strong&gt;.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[React]: Visualize changes in DOM & VirtualDOM]]></title><description><![CDATA[As previously discussed, as state changes in React, it re-renders a particular component, not the whole thing. To visualize the changes of…]]></description><link>https://ellismin.com/2019/11/react-visualize/</link><guid isPermaLink="false">https://ellismin.com/2019/11/react-visualize/</guid><pubDate>Fri, 01 Nov 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;As previously discussed, as state changes in React, it re-renders a particular component, not the whole thing.&lt;/p&gt;&lt;p&gt;To visualize the changes of components, follow the steps below:&lt;/p&gt;&lt;h2 id=&quot;modify-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#modify-appjs&quot; aria-label=&quot;modify appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Modify app.js&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* ... */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;enable-paint-flashing&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#enable-paint-flashing&quot; aria-label=&quot;enable paint flashing permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Enable Paint flashing&lt;/h2&gt;&lt;p&gt;In debugging tool under &lt;em&gt;Rendering&lt;/em&gt;, enable Paint flashing. This allow us to observe changes that flash green.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:327px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:132.09302325581396%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAaCAYAAAC3g3x9AAAACXBIWXMAAAsTAAALEwEAmpwYAAADhUlEQVRIx3VWWXLTQBDNEfKTHwzxEieR7diWZFmrLUte4nhLgCooqjgBlwWUkOIICQV3aPq1PIMiko+unhn39Lx+vcgH91lGA8eher1Op6en1Gw2tWB/dnampfz7c3Jwn93S0HWpeXJC5+fn+gc4qNVqdHx8LFKtVsUhbF4S3BGHs9mMBoMBJUlCy+WS1uu1RmOapgicHx4eil1ZHI7Qtm0ajUa5w3gyoX6/R5Zlked5FAQ+VRlVpVKhdrtNhmFQo9Ggo6Mjtuv/J3iw1+vRcDjMHZqWTa9e1ygaxeSHEYWs09mC+myIcMEvBIjhWMkJ01TcS8h33zKKRy5tE4Omszktr1Za0ulMXkdYQO8y1wgPuhgqkAEpIjnIvmY0Tzz68qEr4YZhSFEUkY91EAgvOFMCnuM4FlsIfocGOnGIsrEGDlXe1PlVW6PByw5IZ+0yAqDAxfF4LDbFjGON8PcOb6UOG406eUFIAXPoBxHFSSqcTtIZeX4oF8BjmTucYQ9+NcKhO5RszheXtFpvRIPPxeWSVpstczkV1EAJdNCIAIJ9t9sV5+Lwx/eMXM+VtAfMWZJMKPB9WfuskQA4QKhpmsp5UOIWVOA+wtchA7rKHESh8TxfnGFfbEOgKXeJRphz2GCkAdfgmDkLaDxJyR44mqNyzb3I4c+7O3bkkcl1BO4Wy6u8Hldr7qDkCV8Kvao/CCi5uLj4l+XfDw+MyJeNFC07MAyUQpNaLUOMO52OCMiHYK3OoXFXI/zz+EteQYuF0YicoUuWPeCsd56EVZTymSqlPcJHrrtAsjTl/p3OF3T99j3X31SjQvuVB4Fao5yggVSyrByiDsGXyzXpSHZdKQ2UDi53+QJslLPytFGhc8iPUocYoDaHioybpsWGpmTZYuI7HRi3qM2IgaJMgcp0waEnpC6WK9rsbmh7/VayfLXest5wt+xozl2zu3knmUfNAa2SVqslPOqQA652wEZ4CQ9bTBskKgwD6QSs1VSBDc6g1Rq/6fEFhDDExIABnGmHzC3WuACNlkPXYA9RYwxgUJOCUIUMDsGXZeXS4xfBKV5GIvB6MURUANZwosoLoJ6EvN7u6OOnz8zjtXAG7lBCEbejwRc7+0yr7wwcYw1HSvKQOVQkJR9ReVv1e/hocZ3tw1FjS7Wd+jSoYau+49ohXox5IEznl5TwUIUgw0BVHBDPSfGPwV+bP1/KGcfSkgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2 1&quot; title=&quot;2 1&quot; src=&quot;/static/a077de323fe9af5e4df476ce1dcbba30/00e65/2-1.png&quot; srcSet=&quot;/static/a077de323fe9af5e4df476ce1dcbba30/2eb24/2-1.png 215w,/static/a077de323fe9af5e4df476ce1dcbba30/00e65/2-1.png 327w&quot; sizes=&quot;(max-width: 327px) 100vw, 327px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Now, when as we type in the text box, we see that only part of a component changes instead of changes in whole DOM.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:780px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:33.02325581395349%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAABwElEQVQozy2P7U/acBSF+5/vwz5s2WbmliyZicbpIm8DeQlsKpEhygAFWx0ygUUH5UXa0lJKQUH27LduH26enJx7c86VHF8cJ5BgEkriRJKkN1YIvHvC3odXJDdfElt/TvD9U5JbQm+vEN18QWrnNaGNZ2R210j4Von7V0kE3hLzv0Fqh/dQI/uo0QPUeJqs7yOprXXykSDH4QCHwR32/dtkwj7SoR2OYp/IRIOkI36KXxIcxkIcRANkU7scfY4h5a4VctVzcldiajLF+hXdvoU2cBkMJmiai67P0PQpujFDH96jCRqCg//asB7QzQfBOZKZOcE4zDHMnjAUNPa/YuVLmMdFj6NCGfPbGaNSBasgmD/FrlxglWXs80vGShVbFrys4lxUkVxNhYcxzMcsui0cWca1BzCzYGoy8Xzb04tem8mPK6ZjTew74A6Z6p1/vpjFoINUV06pVQqMjQ7Lu45IVDxTbzW5qSk0Lss0v1dYuibzvsp9s8FIa3Mtlzzv731dOUNr/2Q5vEMa9X+htRqipMajaOBcKF5jVyTbdy3sfguzc8PvqcW8pzJr1MUzuhdodW+xerfe/cTo8mj0+QNRcOjP6+iuJwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2 2&quot; title=&quot;2 2&quot; src=&quot;/static/4b7b9bef1ca57db67f3bdba0b988e0ad/a1792/2-2.png&quot; srcSet=&quot;/static/4b7b9bef1ca57db67f3bdba0b988e0ad/2eb24/2-2.png 215w,/static/4b7b9bef1ca57db67f3bdba0b988e0ad/05ed2/2-2.png 430w,/static/4b7b9bef1ca57db67f3bdba0b988e0ad/a1792/2-2.png 780w&quot; sizes=&quot;(max-width: 780px) 100vw, 780px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Updating npm packages]]></title><description><![CDATA[Check the version of packages Update Inside  package.json Adding a  ^  sign in front of version allows npm to update to latest stable…]]></description><link>https://ellismin.com/2019/10/npmpkg/</link><guid isPermaLink="false">https://ellismin.com/2019/10/npmpkg/</guid><pubDate>Thu, 31 Oct 2019 00:00:02 GMT</pubDate><content:encoded>&lt;h3 id=&quot;check-the-version-of-packages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#check-the-version-of-packages&quot; aria-label=&quot;check the version of packages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Check the version of packages&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; list react react-dom react-scripts&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;├── react@16.10.2&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;├── react-dom@16.10.2&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;└── react-scripts@3.2.0&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;update&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#update&quot; aria-label=&quot;update permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Update&lt;/h3&gt;&lt;p&gt;Inside &lt;em&gt;package.json&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;gh-pages&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;2.0.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;^16.8.6&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;react-dom&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;^16.8.6&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Adding a &lt;em&gt;^&lt;/em&gt; sign in front of version allows npm to update to latest stable version. When trying to npm install without &lt;em&gt;^&lt;/em&gt; sign, it will install the exact version.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; update&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Update packages to latest version, even without &lt;em&gt;^&lt;/em&gt; sign.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Sometimes update might fail because of versions noted in lock file.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;There may be vulnerabilities regarding security issues in the message.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; audit fix&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Updates to version that doesn&amp;#x27;t have security concerns.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[React]: Without Create React App]]></title><description><![CDATA[Below is vanilla JavaScript that shows how React works without using Create React App index.html Codepen Example]]></description><link>https://ellismin.com/2019/10/react-behind-scene/</link><guid isPermaLink="false">https://ellismin.com/2019/10/react-behind-scene/</guid><pubDate>Thu, 31 Oct 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;Below is vanilla JavaScript that shows how React works without using Create React App&lt;/p&gt;&lt;p&gt;&lt;em&gt;index.html&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;token doctype doctype-tag&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span class=&quot;token doctype&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token doctype name&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token doctype punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;lang&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;en&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;UTF-8&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;viewport&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;width=device-width, initial-scale=1.0&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;meta&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;http-equiv&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;X-UA-Compatible&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;ie-edge&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Some Document&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;React not rendered&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- import react libraries --&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;https://unpkg.com/react@16.7.0/umd/react.production.min.js&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;https://unpkg.com/react-dom@16.7.0/umd/react-dom.production.min.js&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token script language-javascript keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript function-variable function maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token script language-javascript keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;div&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;h1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; props&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; props&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript property-access&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token script language-javascript keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token script language-javascript keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;div&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;h1&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;React is rendered!!&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;Ellis&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;cook&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;Jon&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;singer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token script language-javascript literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;Alex&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token script language-javascript literal-property property&quot;&gt;occupation&lt;/span&gt;&lt;span class=&quot;token script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;developer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token script language-javascript comment&quot;&gt;//   ReactDOM.render(&amp;lt;App /&amp;gt;, document.getElementById(&amp;#x27;root&amp;#x27;));&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token script language-javascript dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token script language-javascript method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token script language-javascript string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token script language-javascript&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx{2-6,&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx{2-6,&quot;&gt;JSX{2-6,&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx{2-6,&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;const App = () =&amp;gt; {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return (&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;lt;div className=&amp;quot;App&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &amp;lt;h1&amp;gt;Hello&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  )&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;// Behind the scene, above code is equivalent to the following&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;const App = () =&amp;gt; {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  return React.createElement(&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;quot;div&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    { className: &amp;quot;App&amp;quot; },&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    React.createElement(&amp;quot;h1&amp;quot;, {}, &amp;quot;hello&amp;quot;)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  )&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;codepen-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#codepen-example&quot; aria-label=&quot;codepen example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Codepen Example&lt;/h2&gt;&lt;iframe height=&quot;565&quot; style=&quot;width:100%&quot; scrolling=&quot;no&quot; title=&quot;React w/o create-react-app&quot; src=&quot;https://codepen.io/dbmin/embed/eYNbGme?height=265&amp;amp;theme-id=dark&amp;amp;default-tab=js,result&quot; frameBorder=&quot;no&quot; allowtransparency=&quot;true&quot; allowfullscreen=&quot;&quot;&gt;See the Pen &lt;a href=&quot;https://codepen.io/dbmin/pen/eYNbGme&quot;&gt;React w/o create-react-app&lt;/a&gt; by Ellis Min (&lt;a href=&quot;https://codepen.io/dbmin&quot;&gt;@dbmin&lt;/a&gt;) on &lt;a href=&quot;https://codepen.io&quot;&gt;CodePen&lt;/a&gt;.&lt;/iframe&gt;</content:encoded></item><item><title><![CDATA[[React]: Handling Events]]></title><description><![CDATA[Handling events with bind() function in class/functional components]]></description><link>https://ellismin.com/2019/10/react-bind/</link><guid isPermaLink="false">https://ellismin.com/2019/10/react-bind/</guid><pubDate>Fri, 04 Oct 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;handling-events-in-functional-component-w-hooks&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#handling-events-in-functional-component-w-hooks&quot; aria-label=&quot;handling events in functional component w hooks permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Handling events in functional component (w/ hooks)&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Name: &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setPersons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;changeNames&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setPersons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;C&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;D&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;changeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;use-bind-when-passing-an-argument&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#use-bind-when-passing-an-argument&quot; aria-label=&quot;use bind when passing an argument permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Use bind() when passing an argument&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Name: &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; setPersons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;useState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;changeNames&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;newName&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setPersons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; newName &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; newName &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;changeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;handling-events-in-class-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#handling-events-in-class-component&quot; aria-label=&quot;handling events in class component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Handling events in class component&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;App.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Name: &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// bind(this) is necessary to make `this` work in the callback&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;C&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;D&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;e&lt;/code&gt; is a &lt;strong&gt;synthetic event&lt;/strong&gt; which is passed in as argument. &lt;code&gt;e.preventDefault()&lt;/code&gt; stops the default action of a selected element&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;using-arrow-functiones6-without-bind&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#using-arrow-functiones6-without-bind&quot; aria-label=&quot;using arrow functiones6 without bind permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using arrow function(ES6) without bind()&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;App.js&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Name: &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  state &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Ensures `this` is bound within handleChangeNames&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;C&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;D&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;passing-arguments&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#passing-arguments&quot; aria-label=&quot;passing arguments permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Passing arguments&lt;/h3&gt;&lt;p&gt;When passing arguments, you&amp;#x27;d still have to bind the function. i.e.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token template-string string&quot;&gt;Name: &lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token template-string interpolation&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  state &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;newName&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; newName &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;D&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;persons&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        =================== OR ===================&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;arrow-functions-vs-bind&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#arrow-functions-vs-bind&quot; aria-label=&quot;arrow functions vs bind permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Arrow functions vs bind()&lt;/h3&gt;&lt;p&gt;When passing arguments, below two lines are equivalent. &lt;code&gt;arrow functions&lt;/code&gt; and &lt;code&gt;Function.prototype.bind&lt;/code&gt; both will work; however, be aware that &lt;code&gt;arrow function&lt;/code&gt; callback gets created each time &lt;code&gt;App.js&lt;/code&gt; renders. This may result in inefficiency when callback is passed as prop to child components that can perform re-rendering. &lt;strong&gt;Thus, bind() is recommended over arrow functions.&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChangeNames&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Z&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Click&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[React]: Basics]]></title><description><![CDATA[Install Create React App npx comes with npm(node package manager) version 5.2+ Under "scripts": in  package.json , it has list of following…]]></description><link>https://ellismin.com/2019/10/react-basics/</link><guid isPermaLink="false">https://ellismin.com/2019/10/react-basics/</guid><pubDate>Thu, 03 Oct 2019 00:00:03 GMT</pubDate><content:encoded>&lt;h2 id=&quot;install-create-react-app&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-create-react-app&quot; aria-label=&quot;install create react app permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Create React App&lt;/h2&gt;&lt;a href=&quot;https://reactjs.org/docs/create-a-new-react-app.html&quot; target=&quot;_blank&quot;&gt;Docs on installing Create React App&lt;/a&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;npx create-react-app my-app&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; my-app&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;npx comes with npm(node package manager) version 5.2+&lt;/p&gt;&lt;p&gt;Under &amp;quot;scripts&amp;quot;: in &lt;em&gt;package.json&lt;/em&gt;, it has list of following commands&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; start&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Start the application in my-app directory&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; build&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Turn all source code from /src/ into code that browser understands(HTML/CSS) and put into /public/ directory.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; run build&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Creates a optimized &lt;em&gt;build&lt;/em&gt; directory with source code. &lt;em&gt;build&lt;/em&gt; folder is what we use to deploy the application.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;test&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Runs test code.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;eject&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Take out config files; not recommended since the source code is already optimized by professionals.&lt;/p&gt;&lt;h3 id=&quot;barbel--webpack&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#barbel--webpack&quot; aria-label=&quot;barbel  webpack permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Barbel &amp;amp; webpack&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Baebel&lt;/strong&gt; makes sure that it will run across all browsers any versions by converting React JS files into older version of JS that web browser understands.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;webpack&lt;/strong&gt; is a module bundler that allows moduler code. It takes all imports and optimize them for production.&lt;/p&gt;&lt;h2 id=&quot;class-components&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#class-components&quot; aria-label=&quot;class components permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Class components&lt;/h2&gt;&lt;h3 id=&quot;appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#appjs&quot; aria-label=&quot;appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;logo&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./logo.svg&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./App.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App-header&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;logo&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App-logo&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;logo&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Hi I&amp;#x27;m Ellis&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App-link&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;https://reactjs.org&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;_blank&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;noopener noreferrer&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          Learn React&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Above code block is just a function that returns a block of HTML&lt;/p&gt;&lt;h3 id=&quot;indexjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#indexjs&quot; aria-label=&quot;indexjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;index.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In index.js, this code renders App function. Replaces id=&amp;#x27;root&amp;#x27; from index.html to &lt;strong&gt;&lt;em&gt;function App()&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;creating-class&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#creating-class&quot; aria-label=&quot;creating class permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating class&lt;/h3&gt;&lt;p&gt;Class has more functionalities than a function. To create a class, import the following. This enables JSX syntax.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Otherwise, you can also do&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;function-to-class&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#function-to-class&quot; aria-label=&quot;function to class permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Function to class&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* Function to class */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App-header&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;logo&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App-logo&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;logo&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Hi I&amp;#x27;m Ellis&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;accessing-state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#accessing-state&quot; aria-label=&quot;accessing state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Accessing state&lt;/h3&gt;&lt;p&gt;Class component allows access to state with constructor.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Ellis&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* ... */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* ... */&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;super() calls constructor method in Component class which gives access to functions such as this.state, this.setState, etc.&lt;/p&gt;&lt;h3 id=&quot;changing-state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#changing-state&quot; aria-label=&quot;changing state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Changing state&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;button onClick&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Min&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Change&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// JavaScript anonymous function that calls this.setState&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As soon as the state changes, &lt;strong&gt;render()&lt;/strong&gt; gets called again&lt;/p&gt;&lt;h3 id=&quot;appjs-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#appjs-1&quot; aria-label=&quot;appjs 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Ellis&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App-header&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;logo&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App-logo&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;logo&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript string&quot;&gt;&amp;quot;Min&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;            Change Text&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;App&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;jsx-syntax&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#jsx-syntax&quot; aria-label=&quot;jsx syntax permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;JSX syntax&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;div className&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;button onClick&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;JSX uses a slightly different attributes from HTML. It uses &lt;strong&gt;className&lt;/strong&gt;, &lt;strong&gt;onClick&lt;/strong&gt; to distinguish it from &lt;strong&gt;class=&amp;quot;&amp;quot;&lt;/strong&gt; and &lt;strong&gt;onclick&lt;/strong&gt;. JSX mimics what HTML does so it can create a virtual DOM.&lt;/p&gt;&lt;p&gt;{} is used for &lt;strong&gt;JavaScript variables or expressions&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;dynamic-content&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#dynamic-content&quot; aria-label=&quot;dynamic content permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Dynamic content&lt;/h2&gt;&lt;p&gt;To display a multiple users&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Bob&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Peter&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;3&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;John&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;4&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To access each element&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* Iterate over every element*/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* key is used to avoid rendering everything but particular obj*/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It is recommended to use &lt;strong&gt;key&lt;/strong&gt; attribute whenever we use &lt;strong&gt;map()&lt;/strong&gt; function.&lt;/p&gt;&lt;h3 id=&quot;using-json-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#using-json-data&quot; aria-label=&quot;using json data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using json data&lt;/h3&gt;&lt;p&gt;For the fake online REST API, visit &lt;a href=&quot;https://jsonplaceholder.typicode.com/users&quot; target=&quot;_blank&quot;&gt;json Data&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Go to Network tab -&amp;gt; refresh page -&amp;gt; users -&amp;gt; Response to preview &lt;strong&gt;response&lt;/strong&gt; data that we&amp;#x27;ll use.&lt;/p&gt;&lt;p&gt;Otherwise, you can log it onto console with the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://jsonplaceholder.typicode.com/users&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Interacting with these APIs is very dynamic. We don&amp;#x27;t need to hard code all these information in HTML/JS/CSS.&lt;/p&gt;&lt;h2 id=&quot;interacting-with-back-end&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#interacting-with-back-end&quot; aria-label=&quot;interacting with back end permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Interacting with back-end&lt;/h2&gt;&lt;p&gt;In real life, we&amp;#x27;d get the information from back-end rather than hard coding the user information.&lt;/p&gt;&lt;h3 id=&quot;life-cycle-methods&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#life-cycle-methods&quot; aria-label=&quot;life cycle methods permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Life cycle methods&lt;/h3&gt;&lt;p&gt;Examples:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;componentDidCatch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentDidUpdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentWillMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentWillReceiveProps&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentWillUnmount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;componentWillUpdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;These methods get called by React at different stages of &lt;strong&gt;when component gets rendered&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When component mounts; when React puts component on page onto DOM for the first time.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Makes URL request&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://jsonplaceholder.typicode.com/users&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; response&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;users2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;users2&lt;/strong&gt; is an array of users in json file. Then, users in constructor is set to users2 from json data&lt;/p&gt;&lt;h2 id=&quot;creating-functional-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#creating-functional-component&quot; aria-label=&quot;creating functional component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Creating functional component&lt;/h2&gt;&lt;p&gt;Component can be built with class like we already have (App component)&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or component can be built with function like&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both always returns JSX.&lt;/p&gt;&lt;h3 id=&quot;cardcomponentjsx-functional-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#cardcomponentjsx-functional-component&quot; aria-label=&quot;cardcomponentjsx functional component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;card.component.jsx (functional component)&lt;/h3&gt;&lt;p&gt;Create &lt;em&gt;src/components/card-list/card-list.component.jsx&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;&lt;em&gt;.jsx&lt;/em&gt; is a naming convention. &lt;em&gt;.js&lt;/em&gt; will also work, but &lt;em&gt;.jsx&lt;/em&gt; is more &lt;strong&gt;explicit&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;react&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function maybe-class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Component takes a &lt;strong&gt;props&lt;/strong&gt; as argument.&lt;/p&gt;&lt;p&gt;Note: each card component does not care about other card.&lt;/p&gt;&lt;h3 id=&quot;import-in-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#import-in-appjs&quot; aria-label=&quot;import in appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;import in app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./components/card-list/card-list.component&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;usage&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#usage&quot; aria-label=&quot;usage permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Ellis&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;First&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Second&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In console it will log &lt;strong&gt;{name: &amp;quot;Ellis&amp;quot;, children: Array(2)}}&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Children are what you pass between the tag.&lt;/p&gt;&lt;h3 id=&quot;add-styling&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-styling&quot; aria-label=&quot;add styling permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add styling&lt;/h3&gt;&lt;p&gt;Create &lt;em&gt;src/components/card-list/card-list.styles.css&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-css&quot;&gt;CSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-css&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector class&quot;&gt;.card-list&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;85&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;vw&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; auto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; grid&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;grid-template-columns&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;fr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;fr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;fr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;fr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;grid-gap&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;import-and-create-classname&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#import-and-create-classname&quot; aria-label=&quot;import and create classname permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;import and create className&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./card-list.styles.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// console.log(props);&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;card-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;put-users-in-cardlist-in-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#put-users-in-cardlist-in-appjs&quot; aria-label=&quot;put users in cardlist in appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Put users in CardList in app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;cardlistcard-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#cardlistcard-component&quot; aria-label=&quot;cardlistcard component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CardList/Card Component&lt;/h2&gt;&lt;p&gt;Make CardList component responsible to each Card List&lt;/p&gt;&lt;h3 id=&quot;appjs-2&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#appjs-2&quot; aria-label=&quot;appjs 2 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Passing users as prop&lt;/p&gt;&lt;h3 id=&quot;card-listcomponentjsx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#card-listcomponentjsx&quot; aria-label=&quot;card listcomponentjsx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;card-list.component.jsx&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./card-list.styles.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;card-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-cardcomponentjsx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-cardcomponentjsx&quot; aria-label=&quot;create cardcomponentjsx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create card.component.jsx&lt;/h3&gt;&lt;p&gt;Create _src/components/card/card.component.jsx__&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Card&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-styling-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-styling-1&quot; aria-label=&quot;add styling 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add styling&lt;/h3&gt;&lt;p&gt;Create &lt;em&gt;src/components/card/card.component.jsx&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-css&quot;&gt;CSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-css&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector class&quot;&gt;.card-container&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-direction&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;lavender&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;grey&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;cursor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pointer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;-moz-osx-font-smoothing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; greyscale&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;backface-visibility&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;translateZ&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; trasnform &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.25&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ease-out&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.card-container&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:hover&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;scale&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1.05&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;card-listcomponentjsx-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#card-listcomponentjsx-1&quot; aria-label=&quot;card listcomponentjsx 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;card-list.component.jsx&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;Card&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;../card/card.component&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./card-list.styles.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;card-list&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;Card&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;update-cardcomponentjsx&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#update-cardcomponentjsx&quot; aria-label=&quot;update cardcomponentjsx permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Update card.component.jsx&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./card.styles.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;Card&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;card-container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt;https://robohash.org/&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation property-access&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string interpolation interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string string&quot;&gt;?set=set4&amp;amp;size=180x180&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript template-string template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By creating CardList and Card component, the app has more &lt;strong&gt;flexibility&lt;/strong&gt; as CardList can take different props. And it can improve &lt;strong&gt;performance&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;state-vs-props&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#state-vs-props&quot; aria-label=&quot;state vs props permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;State vs Props&lt;/h2&gt;&lt;p&gt;As we&amp;#x27;ve had users as state&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and passed onto CardList&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;i.e. CardList component receives the state as prop. This is what generally happens; state often changes because of user interaction.&lt;/p&gt;&lt;p&gt;Changes in state is trickling down the tree in virtual DOM (recall one way data flow). State can turn into props/components.&lt;/p&gt;&lt;p&gt;In our case, &lt;em&gt;users&lt;/em&gt; gets passed down to be used as prop/component. Take a look into the debugging tool:&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:105.11627906976744%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAYAAABG1c6oAAAACXBIWXMAABYlAAAWJQFJUiTwAAAEC0lEQVQ4y42TeVdaVxTF+RKdFBOG52NQNIJj4pDWaLNqjFl1xTQOdYjLxEZtUqcUqyJQUUFAEIX3HvMkxvYr7p57QY2rNat/7HUevHV/b99zzlaFj+KIS0WEjxKQlQKSyTyi0QIOIyWElb8RjJ4jqvwFl/MQomiETifAaDRDL4gQDUbcrdFC/ZUGVdVqfPHl11AN9/fDPvAMq5NzkBMlZJI5OAMlzC3sY/bFW0yOLOHD4hYBfdDW1uGOVoRGZ7iSVm+EWiOg5q5A72qh6up8gDabFT1d3TgKycili1j3fsTU+DomfhjHr6sevF0LYHv7AAaLFbVMJgsEQx30oplLEOtI5WfV0MAgent7MTY2SVfNIJvKYzNwgdV5O2Z+WsKoPYV32wqcLj90tSYI9TYYSeywVm/4l1RDg0Poe9SHWKwIRSkiTcC9YBGOvRTGF4J4uZZEIl6Ck3rIgLX1Vpjqm6EnhwygE4w3pJqcmMHruUWcnOQgy3kkaCixWAFbvgIW3Gf4zZ1FInFxBRSugOYr4A2HXu8pdnZ88HjC5JBNuYDj4zS2N3exteHCht2JUCgBtztQcWiDydLCe/ifDoNBBX6/xCHcYSJPtYT9gxOsrjngcgUQj59zh2yiOlMjRFMT76GGT/ymVD5flAPD4RQHMoeRSIa7Yh8JhZK8BQ66hfqOHlVqLaprdLdKJclnkKQzPhRJylWAWQQDClcgINP08/8LyN6pkrTIqSQDUaUJZ7PltGRy58hkS0hnzlAoXMDl3qdDWnxTreEHq1it6PI/7vD4lIZAipDi8TxBC+S0CL/nCEe+U/j3wohG0vBQ1Ql10OhN0ArUP/212G+WIO5wfCWGF8sSFhwZKFKWnF1gZ3kLs31PMNP5HaY7urEyOg2fX4alpRsGWhmTpZVP+lLmhjZao4Yy8OncLkZereH5vJcGk0A2f4H12SVMNLViqtGKXwaeYubhIzg2dtHW1c9TYrI0Uy3LUEfJIahetJSBi+2DeKOzYannOaKnaWQIuPPOjvnRWdwfnIL4+Gc8GVuEl9bI2trNYeaGa6CRO/4EOP3qTzxrH4NzeBrx9DlS6RK8Tj8cqw6MfP8jTI09mLT7EaY1au74Fg3W+2i0PSg7+8Sh7hK44Erj/R8nCLpCkGltWPQkmRb5/QaWh19iZWoe3lAaB94oh3U+fAxbWw9Es/UaWM+A9WWgc8uD3z/s4OAwRlM+o6TkeDqcFDXXbggOSsguPXs8x9xZe1cf7jV33g7c3NyD3e7m6bjMMktNICDRYstgSQqHk+TwlAM7uvvQ1NJ1O7AcsVQlYhnawyKPHIsjEwNGaA+9PnblMvDe54DBYJzcKBVgljtkUVSUEpcsszZ8hJd6WHbY/1ngP5Y4aUgJf3TuAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1 1&quot; title=&quot;1 1&quot; src=&quot;/static/7e1330460ffdaf45eedd1061854bc458/914ae/1-1.png&quot; srcSet=&quot;/static/7e1330460ffdaf45eedd1061854bc458/2eb24/1-1.png 215w,/static/7e1330460ffdaf45eedd1061854bc458/05ed2/1-1.png 430w,/static/7e1330460ffdaf45eedd1061854bc458/914ae/1-1.png 860w,/static/7e1330460ffdaf45eedd1061854bc458/46115/1-1.png 1290w,/static/7e1330460ffdaf45eedd1061854bc458/c4451/1-1.png 1450w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:157.2093023255814%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAfCAYAAADnTu3OAAAACXBIWXMAABYlAAAWJQFJUiTwAAAFPklEQVRIx5WWeVeSaRjG+QazdJoSUVZZAwQEhDQczEltO2dmrHFLK0tSS3ELSVzSEsw0FMRd2QShaabTmbFvd839PuSaZfPHdZ7n5Zz3x3WvwAstbuNZIIkhfwKB4DaG/XGM+TcQi/2N1tZHOJ8ngFgih4gkkSogEhfRvYjdBQIx+HwhBAV0CkTIp5M36E+ho+8Nmn+5hebaVjRdaUKj8zesRRJoudeJs3mFKBDKICiUHhH3GSd+gYRgYoJJmHid4wm4vGtoKb+Gew99GPTNoH1wDrPBLdxvewy+RAG5rgQSpRaSIhXEpL1TLMvdD4vX93IbnUMRNOhsuDuwiAfeRVxvn8XryJ9ou9+BPApFWWKHSmeFksAyhQZSelEqV+XOY+JxufO/SWL4dgPquxbQ0L8K72gI8cSHXA75BZBrTVCoDFBoiiGRKSGm/H1JvJn5JAamkvBMbuJq1yqaPVGsrmwjHqei3CVgfiEUBitUF8zMIQuXXuTAJ4m3vpbC89k0XOPbuOdLooPOxcghIL+Q5VChNuYcngaMUDX9U0G8mg4zvXhB91cRJBLv94GKYguUnEPtgcMvhhxZSsDn88PlcuPx40G43c8wNTW/D8zjQtYTTGMioJGKoSYnX3G4uprG+noWo6PTGBt7hbm5VXrOsMZuaXXhp/MCyDQGqq4eRSo9tYoSQmpuoVh+oljIodAWlpaSTNzzwsImy2HznXZ8/+M5mgRq3nwRuRWxJv6aeMHgBl6+DFKYCyx/gUAYfn8I0ei7HPDMOTYRe5Nwmnhra1zIOzh8rlDbJCmHHPCH/wvc3IxjK5pANLaNra04OUtgYyOGbOYdNXYbvuNCptk9LdT9kNeoAGHK4fzsMsshdw+Ho4hRyHdpOZw5m0fJVqBAVHSq8umLeQGqbtevDWi/ch2Pqm/AVX0THTdvMaC7fwxCuQ4ag436sOSrUmnNEEqobbrrmtB5ow5NRisa9UY8cDjRaLJgbuI1ep9OQKgpgdbioCkxfRvwSV0z7tgcaFGq0WYvh/uPRtRb7fBRo3tHpqG+YIJaZyZZ2Esq7SlAT1sXBmirOKrqoKppgbSmFeqqBgSmlzDomYScZriktAK28ssMLFMWf4KY2PQoPon7jAEn+kcQoNHr96/AXvk75M7b+PnhMDI7u3jSMwyR7ALKKqphv1QFi90Jq72SvsREooWhyYFzwE8OF0NRDLS44KqoQr1QhFq9FTUPvVjdeIvevhEUStQwWiqgN5XhoqMC5RVOaA1GkgkavYlBjwDXN98iRPP7vMeLMXI76XmOZWqfVOofdLt9KBCrUGq7AoPZRuBiWGzFKC0z0N3IgJxTFv4esLvbg6cE8Y4EKGcTeDo0ie6eIcy+XkbfwDgEYiVM5krojaWURz2FbESZIwfUGU3M6RGH4XAMOUWZQgtbCM7Tz2j0L/T0jjCH1tJqWK015MyCqmo95dNAhTLCetHAoFxOuV3JgNxymJ5exMzMEi2GEFsO3DO3bTggl8MSq5NcOullM4OYbUZKgZHl77OQI5E4W18L5GyenHH3YHAdifh7uKkoErkW5c4aXKqsZaHlAHsQ0+dVXl5O0XZJH1EkkqRt8wE9VBSubawXK2EhHUAOoAd9uFfl9SSOa2Ulhp2d9+jt95FDHTmsZeIgByNoOhmYzWZwXOl0Ch8/7sI7PAqhVANrWSVrasWhyTiu/UnJZLI4rlQqjY+7u3jmG6e/HDrK31U4Ll/7tuWQyWRwWNlslhymsbv7L/WhB/zCIpoSO1XYBqlCd7KocDI6C0Vy/AejmaBoXQp1PAAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1 2&quot; title=&quot;1 2&quot; src=&quot;/static/94f0860fc229533f6ce99ec9cf9597c4/914ae/1-2.png&quot; srcSet=&quot;/static/94f0860fc229533f6ce99ec9cf9597c4/2eb24/1-2.png 215w,/static/94f0860fc229533f6ce99ec9cf9597c4/05ed2/1-2.png 430w,/static/94f0860fc229533f6ce99ec9cf9597c4/914ae/1-2.png 860w,/static/94f0860fc229533f6ce99ec9cf9597c4/2cffa/1-2.png 1092w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;App(root of the tree) has the user array as &lt;strong&gt;state&lt;/strong&gt;. But as it&amp;#x27;s passed down to &lt;em&gt;CardList&lt;/em&gt;, it turns into &lt;strong&gt;prop&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;Again, as the state changes the appropriate component receives the new prop and re-render.&lt;/p&gt;&lt;h2 id=&quot;adding-search-box&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#adding-search-box&quot; aria-label=&quot;adding search box permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding Search Box&lt;/h2&gt;&lt;h3 id=&quot;1-create-state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-create-state&quot; aria-label=&quot;1 create state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Create state&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;2-create-input-for-search-box&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-create-input-for-search-box&quot; aria-label=&quot;2 create input for search box permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Create input for search box&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search users&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// JSX&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;onChange&lt;/em&gt; does not directly modify the DOM unlike &lt;em&gt;onchange&lt;/em&gt; used in HTML. Instead, it runs the &lt;strong&gt;synthetic event&lt;/strong&gt;, whenever input changes in the input box.&lt;/p&gt;&lt;p&gt;With &lt;strong&gt;synthetic event&lt;/strong&gt;, React DOM recognizes change and intercepts to &lt;strong&gt;change the state&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;When we log onto console, it will yield the whole native object. What we&amp;#x27;re interested is in &lt;em&gt;e.target.value&lt;/em&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search users&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:22.790697674418606%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAABYlAAAWJQFJUiTwAAABNklEQVQY012Ov0sCYRyH7x9xUU89QTwvPRGNLgehob2Glmi1IZdAgsgQWouKhiIpgrYKhNoc+weCNikTQ9FLz8NfxNPdwRH1wsOHL+/3fd6PoOtDTHPKYDDCMMZWjplMZgyHI+xTLO4Qi8VIp9NkMhlyuRyBQACPx+MQiURIJpPOTiKRQGg2Z9TrBh9Wvr+ZNBpTul2TVsuk3YZ8vmAtxi3ZPKlUCkVRHKLRKLIsO5+4QvteuNgvcry9yWV5l+rVNZ0udDoDvvrw9PjsyKRwmGAw6DRzcWc7/X7/r3BvZZGD9WVKq1kOtzZ4ffmkp4/oW8Kz0wpxRWYurhIKhayHPkRRdAQu9uz1elFVFU3TEMprS9xXjrg7KXNeKlCr1jBM0Hvf3N48oC1k8fpEq81f0X/sppIk8QNBM+LnlpqQDwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1 3&quot; title=&quot;1 3&quot; src=&quot;/static/4e7e49cee0bc74c16676e711b0376950/914ae/1-3.png&quot; srcSet=&quot;/static/4e7e49cee0bc74c16676e711b0376950/2eb24/1-3.png 215w,/static/4e7e49cee0bc74c16676e711b0376950/05ed2/1-3.png 430w,/static/4e7e49cee0bc74c16676e711b0376950/914ae/1-3.png 860w,/static/4e7e49cee0bc74c16676e711b0376950/8cdda/1-3.png 1168w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;3-store-input-into-state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-store-input-into-state&quot; aria-label=&quot;3 store input into state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Store input into state&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search users&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Try logging into console&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search users&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On console, the state shows search field is &lt;strong&gt;one letter behind&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;It is because &lt;em&gt;setState()&lt;/em&gt; is a &lt;strong&gt;asynchronous&lt;/strong&gt; call that does not happen immediately-- it schedules and batches the work for optimization. i.e. React figures out the best time to update (declarative).&lt;/p&gt;&lt;p&gt;To fix this, use a callback:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search users&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;4-search-user&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-search-user&quot; aria-label=&quot;4 search user permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Search user&lt;/h3&gt;&lt;p&gt;Note that the web app re-renders after the change of state, here, after &lt;em&gt;onChange&lt;/em&gt;. So we can add the code under render method.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Retrive attribute from state and store into const variable&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; searchBox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Above is same as..&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// const uesrs = this.state.users;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// const searchBox = this.state.searchBox;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; filteredUsers &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      user&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;toLowerCase&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;filter()&lt;/em&gt; returns array from function we pass in.&lt;/p&gt;&lt;p&gt;Now we need to pass in filteredUsers into &lt;em&gt;CardList&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;CardList&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;filteredUsers&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;5-make-searchbox-a-component&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-make-searchbox-a-component&quot; aria-label=&quot;5 make searchbox a component permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Make SearchBox a component&lt;/h3&gt;&lt;p&gt;Create the following&lt;/p&gt;&lt;p&gt;&lt;em&gt;src/components/search-box/search-box.component.jsx&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;src/components/search-box/search-box.styles.css&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;search-box.component.jsx&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./search-box.styles.css&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function maybe-class-name&quot;&gt;SearchBox&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; placeholder&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; handleChange &lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;search-box.styles.css&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-css&quot;&gt;CSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-css&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; relative&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;-webkit-transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; width &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.4&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ease-in-out&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; width &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.4&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ease-in-out&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;130&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;aquamarine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/* When input field gets focus, change width*/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;70&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By creating search box as a component, this can be re-used without duplicated codes.&lt;/p&gt;&lt;p&gt;Note: component file doesn&amp;#x27;t have scope to state or life cycle method, but the functional component doesn&amp;#x27;t need them. It just needs to render.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; There is &lt;strong&gt;no state&lt;/strong&gt; inside &lt;em&gt;SearchBox&lt;/em&gt; component because our root of the virtual DOM, App, has two components, &lt;em&gt;CardList&lt;/em&gt; and &lt;em&gt;SearchBox&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;Using state inside &lt;em&gt;SearchBox&lt;/em&gt; disables &lt;em&gt;CardList&lt;/em&gt; to find out what&amp;#x27;s going on in &lt;em&gt;SearchBox&lt;/em&gt;. This is because of &lt;strong&gt;unidirectional data flow&lt;/strong&gt;. This is why &lt;strong&gt;structuring state&lt;/strong&gt; is very important in React.&lt;/p&gt;&lt;h2 id=&quot;writing-methods&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#writing-methods&quot; aria-label=&quot;writing methods permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Writing methods&lt;/h2&gt;&lt;p&gt;From&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;SearchBox&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search users&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can create method&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And call with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag class-name&quot;&gt;SearchBox&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;search users&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here, we encounter an &lt;strong&gt;error&lt;/strong&gt; that &lt;em&gt;this&lt;/em&gt; is undefined. We need to explicitly create a scope in constructor with the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;.bind()&lt;/em&gt; is a method on any function that &lt;strong&gt;returns a new function&lt;/strong&gt; where context of &lt;em&gt;this&lt;/em&gt; is set to whatever we pass to it.&lt;/p&gt;&lt;p&gt;But it&amp;#x27;d be hassle to do it each time in the constructor. There&amp;#x27;s an alternative with arrow function:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleChange&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;searchBox&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; e&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It binds the &lt;em&gt;this&lt;/em&gt; context to the place where they were defined in the first place.&lt;/p&gt;&lt;p&gt;When &lt;em&gt;App&lt;/em&gt; component is instantiated, JS defines all methods of component including the arrow function. Then, it binds automatically.&lt;/p&gt;&lt;p&gt;This is called &lt;em&gt;lexical scope&lt;/em&gt;; a variable defined outside a function can be accessible inside another function defined after the variable declaration.&lt;/p&gt;&lt;p&gt;Similar idea on the console:&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:55.348837209302324%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAACl0lEQVQoz12S7UuTURjGnz9D0G+b29yrz3xsL+pUMqilGEUGEpZ+6FXI0L6FRiKVKJgVQR/CCPwSlFQfKoIoCMSspEDxjag5daab4uYcm8+v8xxSqAMX1zk33BfXdd9Hmcuss5BMEEklWN1JE9O32dSzoEM2l8M4nZ2dqF6VsrIyiZqaGmw2G/n5+RQUFOByufD5fKiqipLUM2wJpATSZCV0Q00cXd+R3NUlBFUvgUBwr1EtLqZYwOs16gFKSzX5VjY2IJHQkRzfIb6WJba8RSqVIRZLkslAW1sHlsIiNK0Uh70Iu4Qdt9sjnTocDgGnrCvvnr9iYnyW968/MvFplqnvERaiQjieEoI5vnz+SThch9Phorp6P4FQFb5gkLJggKqqEEFxN9yVaioet4h8vSlM75ljdJ88RM+pw7wYGuJ3HOF0UziH/r47eFUPbpcXl9uLXdWw2B1YrRZs1kIZ05ihxy2c2j0oN07XcrO5lofd7dxubeDBtQ4mv0XZTGZZXs4w0H+X8MEwmnBRWRkSzU4RvxBbURFWEddkMv2FWbLSdTxEb0sdL4cGGe7r5P7VVr6OzZBM5VhZyTL8+Cn19UfFvNz4/QH2CRizU70lQtxNoRDfFTWbzSiPbnXTd+4E3Y0HuHeljTdPRlhczIm4KVZXdUaevaW2tl4O3piXIWKzWfeWYbVaJRtLMmrKxNg0Pc1HGLzUxPTkInGx7UhkWwhusbYGo6MzBPx+2VRRUSG/jaZpksvLyykpKcHj8Ug4nU6U/guN9J5tYOByC2MfxomtCMFfadbX08JpWmwbWlrOYzKb5AIMJ0bMXVgsln8jz00t8WM+wfzsquB1lpZywmFGCkajW/J/XrjYTl5e3t68jMZd/P/+AybFDX1r4vEUAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1 4&quot; title=&quot;1 4&quot; src=&quot;/static/4335efecd2d64a99ed9bedab49a0a0c8/914ae/1-4.png&quot; srcSet=&quot;/static/4335efecd2d64a99ed9bedab49a0a0c8/2eb24/1-4.png 215w,/static/4335efecd2d64a99ed9bedab49a0a0c8/05ed2/1-4.png 430w,/static/4335efecd2d64a99ed9bedab49a0a0c8/914ae/1-4.png 860w,/static/4335efecd2d64a99ed9bedab49a0a0c8/121b3/1-4.png 1070w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;more-on-function-scope&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-on-function-scope&quot; aria-label=&quot;more on function scope permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More on function scope&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;handleClick2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;handleClick1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;handleClick1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;btn 1 clicked&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;handleClick3&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;btn 3 clicked&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript method function property-access&quot;&gt;handleClick1&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;click 1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleClick1&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;click 2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleClick2&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;click 3&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript script-punctuation punctuation&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript property-access&quot;&gt;handleClick3&lt;/span&gt;&lt;span class=&quot;token tag script language-javascript punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;click 4&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;click 1 calls the function &lt;em&gt;this.handleClick1()&lt;/em&gt; and this gets invoked on &lt;em&gt;render()&lt;/em&gt;, not on click. This is why we shouldn&amp;#x27;t call a function on &lt;strong&gt;event handler&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;click 2 has &lt;em&gt;this.handleClick1&lt;/em&gt; assigned to &lt;em&gt;handleClick1()&lt;/em&gt;. It prints out on console on click. However, when we change it to&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;handleClick1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;handleClick1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;console out &lt;em&gt;this&lt;/em&gt; (app). while..&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;handleClick&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;console out &lt;em&gt;undefined&lt;/em&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;click 3 prints out &amp;quot;btn 1 clicked&amp;quot;. However, since this one is &lt;em&gt;bound&lt;/em&gt; in constructor, it prints &lt;em&gt;this&lt;/em&gt; (app) other than &lt;em&gt;undefined&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;click 4 uses the &lt;strong&gt;arrow function&lt;/strong&gt; so it also prints &lt;em&gt;this&lt;/em&gt; (app) instead of &lt;em&gt;undefined&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Take away is to &lt;strong&gt;use arrow function&lt;/strong&gt; on any class methods you define that isn&amp;#x27;t part of React(i.e. render(), componentDidMount()).&lt;/p&gt;&lt;h2 id=&quot;deploying-app-to-github&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#deploying-app-to-github&quot; aria-label=&quot;deploying app to github permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Deploying app to github&lt;/h2&gt;&lt;h3 id=&quot;1-create-repository-on-github&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-create-repository-on-github&quot; aria-label=&quot;1 create repository on github permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Create repository on github&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:772px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:83.25581395348837%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAAAsTAAALEwEAmpwYAAACKklEQVQ4y5VUWY7bMAzNtdufnqD9aI/Q8xSYLug2mSaT2JF3y5YXWbb8StJJMB1kElTACxktj6T45NU4jviz2eJ+vcZ2uyV/g4eHB3z/8RNZXmBwDtYOBAs7DIKe/IH90zxhnmfwWE3ThFAp7EOFx0hjq0qsgxxpUaFpGtS1IdvCkN+0raA2i89zxizw3i+EzMzwfoabgJECTfj/ceKRDHVVgS2Pvu8RJRnirERe1lSyx0BRGBz0dPAyjiV/urvDmu4xK0rERYNv9wF+bQ5QWYOq84LUWOjOnbN5bv/J8EB3eFAR0iyjRpRIc40kKyjDSmxKczHZJMtRUTVlqZGVtFfHiPKQmtSdiVfc5SRJoYg0pQPcBO8nuQIBrU/TAt470hxbR913o6MrsbKPmyKE8+xlcXDjIpHh5F+HO2GczmdH8lcE1O1ArTfSEI4yUTT/IuYX5o53aEdA5Q2iOBIh970960180mBHgfg/V3JrrPjHdnT5SYwkTeUFMBFny0Tssx2ce9LRK4SeVq3t5fm0bSfPqu26IxmRdj2qupZATHRdh0fZRHGMIAxxOChBECz+breXNa21dPa55i4S8iZdaXrLIVQUYRcERE6ijmLs9ntkJCXOlLPkj8FTQV8smRdb08PoFrqgD0HdScdKXVMgg5g0mmsjT4+obmc4kogfG4WNCQRhm5BQvTRhEE060drkb5MJYW5LvPn6Hq+/vMOrz2/x4ffHqyXdGn8BJZ8ogtZxHUUAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1 5&quot; title=&quot;1 5&quot; src=&quot;/static/d30178211d00440fb1bb71f41d8813d3/940c5/1-5.png&quot; srcSet=&quot;/static/d30178211d00440fb1bb71f41d8813d3/2eb24/1-5.png 215w,/static/d30178211d00440fb1bb71f41d8813d3/05ed2/1-5.png 430w,/static/d30178211d00440fb1bb71f41d8813d3/940c5/1-5.png 772w&quot; sizes=&quot;(max-width: 772px) 100vw, 772px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:30.232558139534888%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAABJklEQVQY022QW0/CQBCF+/8fNSFRVKBl2Xa3sxcxGFsKtBDFQIziJeKfOc7W6pMPX87cdjNzorHUuEo0BoLQTwxSbeGch7HuXyz3yFgMRwkypSHTDEKm0DlhkipERklQKkBkoHXOwwZK6zYPKK5Z/ijUw6NATqbTn9z76xbnPSKyU2S5ZywUeUhlkEwUYpEhYeKOUAs9mYVNcghmwvGvBsJ1kUgJp70+TnrnOLsYIVhwMyswXzYoqxpFtcJtueR8g8f9M3ZPBxzejx2fOLwd8cK8fnxhy/0obDeIJYZC4XLMJ7o7zMo1inqHstm1uqjvMV9tUCyalorjqn7g/h7zNVNv29mgkfNTNpuNDrgpNDlendrTpOpgszOu/aHyLjYdfC7bocniG491cKAzz8VcAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1 6&quot; title=&quot;1 6&quot; src=&quot;/static/f37740a7fb4233a5d3e0a4660ac77aea/914ae/1-6.png&quot; srcSet=&quot;/static/f37740a7fb4233a5d3e0a4660ac77aea/2eb24/1-6.png 215w,/static/f37740a7fb4233a5d3e0a4660ac77aea/05ed2/1-6.png 430w,/static/f37740a7fb4233a5d3e0a4660ac77aea/914ae/1-6.png 860w,/static/f37740a7fb4233a5d3e0a4660ac77aea/561da/1-6.png 969w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; remote &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; origin https://github.com/EllisMin/search-app-.git&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;2-install-gh-pages&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-install-gh-pages&quot; aria-label=&quot;2 install gh pages permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. install gh-pages&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i gh-pages&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;3-prepare-deploy-in-packagejson&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-prepare-deploy-in-packagejson&quot; aria-label=&quot;3 prepare deploy in packagejson permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Prepare deploy in package.json&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;json&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-json&quot;&gt;JSON&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-json&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;my-app&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;homepage&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io/search-app&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;dependencies&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;eject&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;react-scripts eject&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;predeploy&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;npm run build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;&amp;quot;deploy&amp;quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;gh-pages -d build&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; run deploy&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;4-push&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-push&quot; aria-label=&quot;4 push permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Push&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; -A&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; commit -m &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;commitMessage&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; push origin master&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;5-set-up-github-page-branch&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-set-up-github-page-branch&quot; aria-label=&quot;5 set up github page branch permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Set up github page branch&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:751px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:85.5813953488372%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAAAsTAAALEwEAmpwYAAACUUlEQVQ4y51UaXPbIBDV//93Ob40aXxIshNbB0gcEiB43UVWmqSd6aR43uyyoL3e4qJpGlR1hfpUY3c4ICwBvNIH4Iv+t5X4lxIKZRN6BSiTMMoRQz/AjBp6HKGkhB4GDELkvR5GiE4SBJ0pyF5m8D76JUcsXn2He/WCR7XDvfyBB8KjKnEna9wNFckVD2NN9hovriLU2Iczdv70jn08o0kSRbMIPM0H7OjSz7lc4S54dm3G09ze9AYvvsErOgLLK06E+oYyvaGJAoU1E07VGVZZ+MnBWYdJW4Imm85y0obsFrOxMGTTZsGgE27t/tTownmP+vxKhBwzrm0HQx9rY6C1zpL3G+xEmAPUHInAuNKRMiWIKaLwPqDtBZquhxwUXFjwnZWdpTXFyCwbyuBwPKIsS1wuFwzEpiRmJTHMuhDEIrEstUerAmYfPzv66tA5j0NFrJUV9scKI/UoBA/nHLxfZUaI2dkS0+8yP2ALUrDXQGX6EOB8wP+tNUiM1ENrJ3olJyq5Qtu2mOf5PSvWJ8Y0ERlTlh/PHeuUhHExV5AznGdHjjo0TYuOiaHetSQvtB+Vwjgy1r5yT9lm8gTcpoDGrNcLNLGOXHL884VaCqJo5r672FfBdXPUnAG91UC93BrNZ/9GWnG7X/CHPc3h6XzG2+UKRSwrKsWYdbhZ54BcIpdqbzbes4NPGXLJ7JA/FnLtkaAecrYdBelpBnshMiSdt/RP1A2G7ukceA2yBt4qyw6Zwe3CmDM075luOmc36AmCBnwmZtnBsiwZPHZbC34B8NwmIYmKU1oAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1 7&quot; title=&quot;1 7&quot; src=&quot;/static/686e4cd8a07c0f5fba89d04757d50361/c483d/1-7.png&quot; srcSet=&quot;/static/686e4cd8a07c0f5fba89d04757d50361/2eb24/1-7.png 215w,/static/686e4cd8a07c0f5fba89d04757d50361/05ed2/1-7.png 430w,/static/686e4cd8a07c0f5fba89d04757d50361/c483d/1-7.png 751w&quot; sizes=&quot;(max-width: 751px) 100vw, 751px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Now check the &lt;a href=&quot;https://ellismin.github.io/search-app/&quot; target=&quot;_blank&quot;&gt;website &lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[React]: Concepts]]></title><description><![CDATA[History 1990's ~ early 2000's In 1990's and 2000's basics for font-end development were HTML/JS/CSS. HTML to display text, CSS for styles…]]></description><link>https://ellismin.com/2019/10/react-concepts/</link><guid isPermaLink="false">https://ellismin.com/2019/10/react-concepts/</guid><pubDate>Thu, 03 Oct 2019 00:00:02 GMT</pubDate><content:encoded>&lt;h2 id=&quot;history&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#history&quot; aria-label=&quot;history permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;History&lt;/h2&gt;&lt;h3 id=&quot;1990s--early-2000s&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1990s--early-2000s&quot; aria-label=&quot;1990s  early 2000s permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1990&amp;#x27;s ~ early 2000&amp;#x27;s&lt;/h3&gt;&lt;p&gt;In 1990&amp;#x27;s and 2000&amp;#x27;s basics for font-end development were HTML/JS/CSS.&lt;/p&gt;&lt;p&gt;HTML to display text, CSS for styles and JS for interactivity with users.&lt;/p&gt;&lt;p&gt;When a user visits a URL, the server sends HTML/JS/CSS files. Then, when user submits a form, it gets sent back to the back end.&lt;/p&gt;&lt;p&gt;When a user requests a link, &lt;strong&gt;new HTML/JS/CSS gets sent&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: All websites runs by different browsers (Firefox, Safari, Chrome, etc); JavaScript worked different across different browsers&lt;/p&gt;&lt;h3 id=&quot;jqery&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#jqery&quot; aria-label=&quot;jqery permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;jQery&lt;/h3&gt;&lt;p&gt;jQuery allowed developers to easily interact with DOM(Document Object Model) across all browsers. DOM is the page or elements in debugging console, and JavaScript modifies these elements. jQuery had an unified, easy API that works across all browsers.&lt;/p&gt;&lt;h3 id=&quot;example-of-jquery&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-of-jquery&quot; aria-label=&quot;example of jquery permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example of jQuery&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// jQuery Selectors&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// hide all &amp;lt;p&amp;gt; elements&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;#test&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// hide elements with id=&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.test&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// hide ALL elements with class=&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// hide current HTML element&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//jQuery Events&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// And more&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;More jQuery examples found on &lt;a href=&quot;https://www.w3schools.com/jquery/jquery_examples.asp&quot; target=&quot;_blank&quot;&gt;w3schools&lt;/a&gt;&lt;/p&gt;&lt;p&gt;With jQuery, JavaScript files started to become larger and larger. Backbone.js library came out to organize these JS files--it became easier to work with DOM and SPA came out.&lt;/p&gt;&lt;h3 id=&quot;spasingle-page-application&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#spasingle-page-application&quot; aria-label=&quot;spasingle page application permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;SPA(Single Page Application)&lt;/h3&gt;&lt;p&gt;Traditionally, we&amp;#x27;ve had HTML/JS/CSS for each page, but with advancement with jQuery, JS library(backbone.js), and Ajax, we started to focus more on JS than HTML. Instead of requesting from the server a multiple times, we could load the application only once; we could stay on a page the entire time and based on what&amp;#x27;s written on JS, JS changed/updated the HTML elements/DOM to display new things.&lt;/p&gt;&lt;h3 id=&quot;angular-js2010&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#angular-js2010&quot; aria-label=&quot;angular js2010 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Angular JS(2010)&lt;/h3&gt;&lt;p&gt;Angular JS by Google allowed to create large applications by forming containers that wrapped our project based on MVC design; each JS files were divided into Model/View/Controller. Organizing these codes in larger projects made Angular more popular.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: Applications started to get more complex as websites needed to handle more and more user interactivity. Data was flowing everywhere, and it became harder to find bugs. Each update of an app started to cause more issues. They needed to update their &lt;strong&gt;code base&lt;/strong&gt; and have better architecture; how to organize, manipulate data and manage data flows.&lt;/p&gt;&lt;h3 id=&quot;react2013&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#react2013&quot; aria-label=&quot;react2013 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;React(2013)&lt;/h3&gt;&lt;p&gt;React by Facebook allowed a new way of developing front end&lt;/p&gt;&lt;h3 id=&quot;angular-2014&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#angular-2014&quot; aria-label=&quot;angular 2014 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Angular (2014)&lt;/h3&gt;&lt;p&gt;Complete rewritten version of Angular JS came out. Called Angular (without JS).&lt;/p&gt;&lt;h2 id=&quot;react-concepts&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#react-concepts&quot; aria-label=&quot;react concepts permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;React Concepts&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;React is &lt;strong&gt;declarative&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;Reusable Components&lt;/li&gt;&lt;li&gt;One Way Data Flow (Unidirectional)&lt;/li&gt;&lt;li&gt;User Interface based&lt;/li&gt;&lt;/ol&gt;&lt;h2 id=&quot;1-declarative-vs-imperative&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-declarative-vs-imperative&quot; aria-label=&quot;1 declarative vs imperative permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Declarative vs Imperative&lt;/h2&gt;&lt;h3 id=&quot;imperative&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#imperative&quot; aria-label=&quot;imperative permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Imperative&lt;/h3&gt;&lt;p&gt;Let&amp;#x27;s first look at the &lt;strong&gt;Imperative programming&lt;/strong&gt;. Before react, many frameworks/libraries directly manipulated the DOM. This is called &lt;strong&gt;imperative (paradigm)&lt;/strong&gt;--directly changes an individual part of app in response to various user events.&lt;/p&gt;&lt;p&gt;Ex) When a user is logged in, go change an icon, display friends, display chat, and so on. This is intuitive, but it is &lt;strong&gt;difficult to observe the relationship&lt;/strong&gt; between events and edge cases (like AngularJS).&lt;/p&gt;&lt;h3 id=&quot;dom-document-object-model&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#dom-document-object-model&quot; aria-label=&quot;dom document object model permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DOM (Document Object Model)&lt;/h3&gt;&lt;p&gt;DOM is what browsers uses to display the web app. JS(jQuery or JS library) traverses and manipulates the DOM--true representation of page.&lt;/p&gt;&lt;p&gt;DOM manipulation is an expensive operation or inefficient. It takes a long time to change; browser has to repaint(change element &amp;amp; add it onto page), and re-flow(recalculate layout of page).&lt;/p&gt;&lt;h3 id=&quot;example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example&quot; aria-label=&quot;example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getElementsByTagName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;parentNode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerHTML&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;dump&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;scrollTo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;declarative&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#declarative&quot; aria-label=&quot;declarative permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Declarative&lt;/h3&gt;&lt;p&gt;React is declarative (paradigm); it &lt;strong&gt;finds out the best way to change the DOM on its own&lt;/strong&gt;. We need to &lt;strong&gt;declare&lt;/strong&gt; what the app looks like. Other than telling the app exactly what do do (imperative), we need to declare the state and components.&lt;/p&gt;&lt;p&gt;Ex) JavaScript object&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; state &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Ellis Min&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;isLoggedIn&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;friends&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Paul&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Smith&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;John&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the user is logged in, React will know what to do. This has less complexity, better code quality, and faster development than programming individual cases of user interaction.&lt;/p&gt;&lt;h2 id=&quot;2-reusable-components&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-reusable-components&quot; aria-label=&quot;2 reusable components permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Reusable components&lt;/h2&gt;&lt;p&gt;React builds websites like lego blocks with reusable components that people can customize. Ex) material-ui component, React-Bootstrap, blueprint, etc. They can share these components--&lt;strong&gt;JS functions&lt;/strong&gt; that accepts attributes (props).&lt;/p&gt;&lt;p&gt;Ex) Component example as var/function/class&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; element &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; hello world&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;homepage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Hello, &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;homepage&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token class-name punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Hello, &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This components uses &lt;strong&gt;JSX syntax&lt;/strong&gt;, HTML inside JS.&lt;/p&gt;&lt;h3 id=&quot;view-react-component-in-your-browser-installation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#view-react-component-in-your-browser-installation&quot; aria-label=&quot;view react component in your browser installation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;View React component in your browser (Installation)&lt;/h3&gt;&lt;p&gt;Install &lt;a href=&quot;https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en&quot; target=&quot;_blank&quot;&gt;React Developer Tools extension&lt;/a&gt;&lt;/p&gt;&lt;h2 id=&quot;3-unidirectional-data-flow&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-unidirectional-data-flow&quot; aria-label=&quot;3 unidirectional data flow permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Unidirectional data flow&lt;/h2&gt;&lt;h3 id=&quot;state&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#state&quot; aria-label=&quot;state permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;State&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; state &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Ellis Min&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;isLoggedIn&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;friends&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Paul&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Smith&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;John&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;jsx-html-inside-js&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#jsx-html-inside-js&quot; aria-label=&quot;jsx html inside js permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;JSX (HTML inside JS)&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; element &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Hi&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;Nice to meet you.&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h2&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain-text&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain-text&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;State and component provides React library(function) that accepts them&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;jsx&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-jsx&quot;&gt;JSX&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-jsx&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function maybe-class-name&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; components&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;React with state and components create &lt;strong&gt;virtual DOM&lt;/strong&gt; which is &lt;strong&gt;JavaScript object(DOM)&lt;/strong&gt;, and it works like &lt;strong&gt;blueprint that tells React how it should update the actual DOM&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;This is &lt;strong&gt;Unidirectional data flow&lt;/strong&gt;. i.e. data flows only one way.&lt;/p&gt;&lt;p&gt;When we want something to change (in actual DOM), &lt;strong&gt;state&lt;/strong&gt; has to change. After the change, React combines new state with components and updates the DOM.&lt;/p&gt;&lt;h3 id=&quot;virtual-dom&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#virtual-dom&quot; aria-label=&quot;virtual dom permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Virtual DOM&lt;/h3&gt;&lt;p&gt;Virtual DOM describes web app and has tree-like objects where data only moves downward.&lt;/p&gt;&lt;p&gt;With these restrictions, it&amp;#x27;s easy to debug our code. ex) When there&amp;#x27;s something wrong with logout function, you just have to look through components that resides in upper part of DOM.&lt;/p&gt;&lt;h2 id=&quot;4-ui-based&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-ui-based&quot; aria-label=&quot;4 ui based permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. UI based&lt;/h2&gt;&lt;p&gt;AngularJS was a framework. like a kitchen providing the developer ALL the tools that&amp;#x27;s necessary to build an app.&lt;/p&gt;&lt;p&gt;React (&lt;strong&gt;library&lt;/strong&gt;) only cares about the idea of &lt;strong&gt;components&lt;/strong&gt; and &lt;strong&gt;virtual DOM&lt;/strong&gt;. We&amp;#x27;d need need other modules to customize our needs. This allows cross platform development.&lt;/p&gt;&lt;p&gt;need two libraries to import Core react library and react DOM library&lt;/p&gt;&lt;h2 id=&quot;goals-with-react&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#goals-with-react&quot; aria-label=&quot;goals with react permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Goals with react&lt;/h2&gt;&lt;p&gt;Good react developers do the following&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Decide on components&lt;/li&gt;&lt;li&gt;Decide the state and where it lives; in the hierarchical design&lt;/li&gt;&lt;li&gt;What changes when state changes&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[MySQL]: Install MySQL on Mac]]></title><description><![CDATA[Installation Process Download MySQL Download MySQL Community Server from  MySQL download  & install the package. 
When installing, remember…]]></description><link>https://ellismin.com/2019/10/mysql-install/</link><guid isPermaLink="false">https://ellismin.com/2019/10/mysql-install/</guid><pubDate>Wed, 02 Oct 2019 00:00:03 GMT</pubDate><content:encoded>&lt;h2 id=&quot;installation-process&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#installation-process&quot; aria-label=&quot;installation process permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation Process&lt;/h2&gt;&lt;h3 id=&quot;download-mysql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#download-mysql&quot; aria-label=&quot;download mysql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Download MySQL&lt;/h3&gt;&lt;p&gt;Download MySQL Community Server from &lt;a href=&quot;https://dev.mysql.com/downloads/mysql/&quot; target=&quot;_blank&quot;&gt;MySQL download&lt;/a&gt; &amp;amp; install the package.&lt;br/&gt;
When installing, remember the &lt;strong&gt;password&lt;/strong&gt;!&lt;/p&gt;&lt;h3 id=&quot;start-the-server&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#start-the-server&quot; aria-label=&quot;start the server permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Start the server&lt;/h3&gt;&lt;p&gt;Open &lt;strong&gt;System Preference&lt;/strong&gt; --&amp;gt; &lt;strong&gt;MySQL&lt;/strong&gt; --&amp;gt; Start MySQL Server&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:82.32558139534883%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAABYlAAAWJQFJUiTwAAACZElEQVQ4y4WUWVMaQRSF52+orEYjDDDMPsMOsoMMGmWxcEmVecxz/kR+9Mk9XbRKSsuHUw3N7a/PXRrjqh2i264huVpgMZ/jZrlEu9VC6PuI/SpCp4xBtyUxHXiOg4D7QYAormO5fsSP+2ckq53SUmRYlg27asMql0UVWJWKOug4PtyrP4i2fxHOf+PuOsF2vcF8NoMrv7uOnLMsVEW2UlV9NgLPQxQGaDYaaDWbqMWxgtu2Ayseo9pIEDQnGFz2MOj30e10EIpDX5xyjaMQcSiKIpWV4bkuehK8elrj18sLfj4/o9vtiusqPLsM1zIRuDZ8zwdj6a5eq6EnMao0AmUZIoFyNVzbRqlkotaLMR2PMZ1MwL30yQlymSwyqTTMYlE5oHtmwZjVaoVksUCn3VbZafAeWEZrMMZoMFA3f8vnFTCbTqvVLBQUkOJhggmgq0a9rhRqh2xAXgBnhRIK389xcX6ugJlU6gDIw4QM5VI6WyaJWtkkuvalF4GuYT6bRfroSB2mNEwDiwKkMzbk5voa280Gm/Uaa0n77vYWo+EQTYHywlcga6Uh1HuHxYsLVavLXk+VhI60eAn3+jIB0SEwdQB871CnHOzT0g3gWd35w5RzuS+BbAihejyY5sNuh/vtFk+Pj5hNpwr+VsN97f5X+vhY1VAN7r6zXFlTDjrTZdr8TpeGL8Cz01PkBJr/QLlMBiXTPHCooUyVM0mXE5lh5dDf14Hj85l0fT4SX8t4NFINYqzBh+3IM/tK9uufwJu4z3dfMYso2T4sR1L+LPijwwcXcLUqqHghyp0+diOZ1dDCP2VcAbeFbVMsAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;download&quot; title=&quot;download&quot; src=&quot;/static/8dfd9e8cea5402e0aed835e38954b9ef/914ae/download.png&quot; srcSet=&quot;/static/8dfd9e8cea5402e0aed835e38954b9ef/2eb24/download.png 215w,/static/8dfd9e8cea5402e0aed835e38954b9ef/05ed2/download.png 430w,/static/8dfd9e8cea5402e0aed835e38954b9ef/914ae/download.png 860w,/static/8dfd9e8cea5402e0aed835e38954b9ef/46115/download.png 1290w,/static/8dfd9e8cea5402e0aed835e38954b9ef/86a1e/download.png 1296w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;enable-mysql-command-in-terminal&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#enable-mysql-command-in-terminal&quot; aria-label=&quot;enable mysql command in terminal permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Enable mysql command in terminal&lt;/h3&gt;&lt;p&gt;Open .bash_profile with the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;vim&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/.bash_profile&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;# OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ~/.bash_profile&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-the-following-in-bash_profile&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-the-following-in-bash_profile&quot; aria-label=&quot;add the following in bash_profile permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add the following in .bash_profile&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token assign-left variable environment constant&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token variable environment constant&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;:/usr/local/mysql/bin/&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, &lt;strong&gt;reopen&lt;/strong&gt; the terminal to use mysql command&lt;/p&gt;&lt;h3 id=&quot;in-terminal-run&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#in-terminal-run&quot; aria-label=&quot;in terminal run permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;In terminal, run:&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ mysql -u root -p&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, type in the password you&amp;#x27;ve set during installation.&lt;br/&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;TIP: Consider creating alias for command from &lt;a href=&quot;/2019/04/alias/&quot;&gt;this post&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;try-show-databases&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#try-show-databases&quot; aria-label=&quot;try show databases permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Try show databases&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; show databases;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Database           |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| information_schema |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| mysql              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| performance_schema |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sys                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;4 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If it &lt;strong&gt;doesn&amp;#x27;t work&lt;/strong&gt;, run the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ALTER &lt;/span&gt;&lt;span class=&quot;token environment constant&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;root&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;@localhost&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; IDENTIFIED BY &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;NEWPASSWORD&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;change-mysql_native_password-for-nodejs-mysql-connection&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#change-mysql_native_password-for-nodejs-mysql-connection&quot; aria-label=&quot;change mysql_native_password for nodejs mysql connection permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Change mysql_native_password for Node.js mysql connection&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ALTER &lt;/span&gt;&lt;span class=&quot;token environment constant&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;root&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;localhost&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; IDENTIFIED WITH mysql_native_password BY &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;password&amp;#x27;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;root&lt;/em&gt;: user name&lt;br/&gt;
&lt;em&gt;localhost&lt;/em&gt;: your URL&lt;br/&gt;
&lt;em&gt;password&lt;/em&gt;: your password&lt;/p&gt;&lt;h3 id=&quot;set-sql_mode&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#set-sql_mode&quot; aria-label=&quot;set sql_mode permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Set sql_mode=&amp;#x27;&amp;#x27;;&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;SET @@global.sql_mode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Avoids some errors instead of showing warnings&lt;/p&gt;&lt;h2 id=&quot;setting-a-new-password&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#setting-a-new-password&quot; aria-label=&quot;setting a new password permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Setting a new password&lt;/h2&gt;&lt;p&gt;In MySQL Terminal, type in the following:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ALTER &lt;/span&gt;&lt;span class=&quot;token environment constant&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;root&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;localhost&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; IDENTIFIED BY &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;NEW_USER_PASSWORD&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; FLUSH PRIVILEGES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Change root to &lt;strong&gt;other user name&lt;/strong&gt; when needed.&lt;br/&gt;
FLUSH PRIVILEGES tells the server to reload the grant tables.&lt;/p&gt;&lt;p&gt;If ALTER USER doesn&amp;#x27;t work, modify the user table with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPDATE mysql.user SET authentication_string &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; PASSWORD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;NEW_USER_PASSWORD&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;WHERE User &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;user-name&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; AND Host &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;localhost&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;FLUSH PRIVILEGES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;lost-mysql-password&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#lost-mysql-password&quot; aria-label=&quot;lost mysql password permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Lost mysql password?&lt;/h2&gt;&lt;p&gt;Use FLUSH PRIVILEGES when you&amp;#x27;re logged into MySQL terminal. Otherwise:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ mysql -u root&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; USE mysql&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPDATE user SET &lt;/span&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;PASSWORD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;NEW_USER_PASSWORD&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; WHERE &lt;/span&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;root&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; FLUSH PRIVILEGES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; quit&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Database Triggers]]></title><description><![CDATA[Database triggers  are SQL statements that  automatically runs  when a specified table is changed. For example, it can be useful when…]]></description><link>https://ellismin.com/2019/10/sql-triggers/</link><guid isPermaLink="false">https://ellismin.com/2019/10/sql-triggers/</guid><pubDate>Wed, 02 Oct 2019 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;Database triggers&lt;/strong&gt; are SQL statements that &lt;strong&gt;automatically runs&lt;/strong&gt; when a specified table is changed. For example, it can be useful when updating a total.&lt;/p&gt;&lt;h2 id=&quot;syntax&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#syntax&quot; aria-label=&quot;syntax permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Syntax&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TRIGGER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; trigger_name&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    trigger_time trigger_event &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; table_name &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOR EACH ROW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BEGIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;trigger_time: BEFORE, AFTER&lt;br/&gt;
trigger_event: INSERT, UPDATE, DELETE&lt;br/&gt;&lt;/p&gt;&lt;h2 id=&quot;example-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-1&quot; aria-label=&quot;example 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 1&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    username &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Jack&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;YoungBoy&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-trigger&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-trigger&quot; aria-label=&quot;create trigger permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create trigger&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; $$&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TRIGGER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; check_age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    BEFORE &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOR EACH ROW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BEGIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; NEW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            SIGNAL SQLSTATE &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;45000&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; MESSAGE_TEXT &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Must be 18 or older&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$$&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;try-insert&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#try-insert&quot; aria-label=&quot;try insert permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Try insert&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Robert&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Patrick&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; INSERT INTO users VALUES(&amp;quot;Robert&amp;quot;, 19);&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Query OK, 1 row affected (0.01 sec)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; INSERT INTO users VALUES(&amp;quot;Patrick&amp;quot;, 17);&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ERROR 1644 (45000): Must be 18 or older&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now it throws an error if you&amp;#x27;re trying to insert.&lt;/p&gt;&lt;h3 id=&quot;syntax-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#syntax-1&quot; aria-label=&quot;syntax 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Syntax&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;NEW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;NEW&lt;/em&gt; is a placeholder referring to the data about to be inserted.&lt;br/&gt;
Use &lt;em&gt;OLD&lt;/em&gt; to access data that was deleted.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;SIGNAL SQLSTATE &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;45000&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; MESSAGE_TEXT &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Must be 18 or older&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;These syntax is for MySQL error (&lt;a href=&quot;https://dev.mysql.com/doc/refman/5.5/en/server-error-reference.html&quot; target=&quot;_blank&quot;&gt;MySQL documentation&lt;/a&gt;)&lt;br/&gt;
&lt;em&gt;45000&lt;/em&gt;: a numeric error code (MySQL specific)&lt;br/&gt;
&lt;em&gt;SQLSTATE&lt;/em&gt;: 5 letter signal state code that can be recognized across different databases&lt;br/&gt;
&lt;em&gt;MESSAGE_TEXT&lt;/em&gt;: description of the error&lt;/p&gt;&lt;p&gt;&lt;em&gt;45000&lt;/em&gt; is a state representing &amp;quot;unhandled user-defined exception&amp;quot;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; $$&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$$&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;MySQL by default recognizes semi-colon as end of query.&lt;/p&gt;&lt;p&gt;&lt;em&gt;DELIMITER \$\$&lt;/em&gt; sets a new delimiter to \$\$ from ;&lt;/p&gt;&lt;p&gt;&lt;em&gt;DELIMITER ;&lt;/em&gt; sets it back to semi-colon&lt;/p&gt;&lt;p&gt;You can set DELIMITER to however you want.&lt;/p&gt;&lt;h2 id=&quot;example-2&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-2&quot; aria-label=&quot;example 2 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 2&lt;/h2&gt;&lt;p&gt;Back in our &lt;a href=&quot;/2019/09/sql-igdb/#tables&quot;&gt;Instagram clone&lt;/a&gt; database, the following code was allowed, although it shouldn&amp;#x27;t be. i.e. following oneself.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Prevent following oneself on Instagram&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TRIGGER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; prevent_follow_self&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    BEFORE &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOR EACH ROW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BEGIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; NEW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; NEW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;followee_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            SIGNAL SQLSTATE &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;45000&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; MESSAGE_TEXT &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;User can&amp;#x27;t follow oneself&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;result&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#result&quot; aria-label=&quot;result permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Result&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; INSERT INTO follows(follower_id, followee_id) VALUES(3, 3);&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ERROR 1644 (45000): User can&amp;#x27;t follow oneself&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;example-3&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-3&quot; aria-label=&quot;example 3 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 3&lt;/h2&gt;&lt;p&gt;Log unfollows&lt;/p&gt;&lt;p&gt;Create unfollows table (columns are same as follows table).&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; unfollows &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    follower_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    followee_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;create-trigger-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-trigger-1&quot; aria-label=&quot;create trigger 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create trigger&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TRIGGER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log_unfollow&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AFTER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOR EACH ROW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BEGIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; unfollows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;OLD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; OLD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;OLD&lt;/em&gt; is a data that was deleted&lt;/p&gt;&lt;h3 id=&quot;using-set-same-trigger&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#using-set-same-trigger&quot; aria-label=&quot;using set same trigger permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using SET (same trigger)&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TRIGGER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log_unfollow&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AFTER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOR EACH ROW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BEGIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; unfollows&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follower_id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; OLD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;            followee_id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; OLD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELIMITER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;test&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#test&quot; aria-label=&quot;test permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follower_id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; followee_id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follower_id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; followee_id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; unfollows&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| follower_id | followee_id | created_at          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           5 |           7 | 2019-10-03 05:07:15 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          11 |           3 | 2019-10-03 05:07:15 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;remove-trigger&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#remove-trigger&quot; aria-label=&quot;remove trigger permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Remove trigger&lt;/h2&gt;&lt;h3 id=&quot;show-trigger&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#show-trigger&quot; aria-label=&quot;show trigger permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Show trigger&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SHOW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; triggers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;drop&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#drop&quot; aria-label=&quot;drop permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DROP&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DROP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TRIGGER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; triggername&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;caveat&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#caveat&quot; aria-label=&quot;caveat permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Caveat&lt;/h2&gt;&lt;p&gt;Triggers can make &lt;strong&gt;debugging difficult&lt;/strong&gt;. When trigger is causing a bug, it is hard to capture it because triggers work behind the scene.&lt;/p&gt;&lt;p&gt;When you&amp;#x27;re using a multiple triggers, there&amp;#x27;s probably a way of doing it without using the trigger. It may be a better implementation without using the trigger.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Subscription Application]]></title><description><![CDATA[Create web app using various Node.js frameworks (Express, EJS, body-parser)]]></description><link>https://ellismin.com/2019/10/subscription-app/</link><guid isPermaLink="false">https://ellismin.com/2019/10/subscription-app/</guid><pubDate>Wed, 02 Oct 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;This post uses a light weight Nods.js framework, &lt;a href=&quot;http://expressjs.com/&quot; target=&quot;_blank&quot;&gt;Express&lt;/a&gt; to create a web app that takes users&amp;#x27; subscription and store into mysql database.&lt;/p&gt;&lt;p&gt;More Node frameworks can be found from &lt;a href=&quot;http://nodeframework.com/&quot; target=&quot;_blank&quot;&gt;Node frameworks&lt;/a&gt;&lt;/p&gt;&lt;h2 id=&quot;express&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#express&quot; aria-label=&quot;express permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Express&lt;/h2&gt;&lt;h3 id=&quot;create-packagejson&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-packagejson&quot; aria-label=&quot;create packagejson permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create package.json&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; init&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Creates &lt;em&gt;package.json&lt;/em&gt; acts as a log file that records which package &amp;amp; versions were installed. For example, installation using &lt;strong&gt;npm install&lt;/strong&gt;, will look up &lt;em&gt;package.json&lt;/em&gt; and install all necessary packages at once.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ npm init&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;This utility will walk you through creating a package.json file.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;It only covers the most common items, and tries to guess sensible de&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;faults.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;See `npm help json` for definitive documentation on these fields&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;and exactly what they do.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Use `npm install &amp;lt;pkg&amp;gt;` afterwards to install a package and&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;save it as a dependency in the package.json file.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Press ^C at any time to quit.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;package name: (subscription)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;version: (1.0.0)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;description:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;entry point: (index.js) app.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;test command:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;git repository:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;keywords:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;author:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;license: (ISC)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;About to write to /workspace/mySQL4613/subscription/package.json:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;name&amp;quot;: &amp;quot;subscription&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;main&amp;quot;: &amp;quot;app.js&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;scripts&amp;quot;: {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;quot;test&amp;quot;: &amp;quot;echo \&amp;quot;Error: no test specified\&amp;quot; &amp;amp;&amp;amp; exit 1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  },&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;author&amp;quot;: &amp;quot;&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;license&amp;quot;: &amp;quot;ISC&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Is this OK? (yes)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;install-express&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-express&quot; aria-label=&quot;install express permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Express&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i express&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;--save&lt;/em&gt; flag saves express into json file, but current npm supports it as default&lt;/p&gt;&lt;h3 id=&quot;install-faker-mysql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-faker-mysql&quot; aria-label=&quot;install faker mysql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install Faker, MySQL&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i faker mysql&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Updated &lt;em&gt;package.json&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;name&amp;quot;: &amp;quot;subscription&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;version&amp;quot;: &amp;quot;1.0.0&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;main&amp;quot;: &amp;quot;app.js&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;scripts&amp;quot;: {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;quot;test&amp;quot;: &amp;quot;echo \&amp;quot;Error: no test specified\&amp;quot; &amp;amp;&amp;amp; exit 1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  },&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;author&amp;quot;: &amp;quot;&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;license&amp;quot;: &amp;quot;ISC&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &amp;quot;dependencies&amp;quot;: {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;quot;express&amp;quot;: &amp;quot;^4.17.1&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;quot;faker&amp;quot;: &amp;quot;^4.1.0&amp;quot;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &amp;quot;mysql&amp;quot;: &amp;quot;^2.17.1&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;installing-them-with-packagejson&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#installing-them-with-packagejson&quot; aria-label=&quot;installing them with packagejson permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installing them with package.json&lt;/h3&gt;&lt;p&gt;When you have above json file, you can run&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To install all the packages automatically&lt;/p&gt;&lt;h2 id=&quot;request--response-get&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#request--response-get&quot; aria-label=&quot;request  response get permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Request &amp;amp; Response (GET)&lt;/h2&gt;&lt;p&gt;Create app.js file&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// import the package&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// execute entire express&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;hello worlddd&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Client --&amp;gt; Express App(Node)&lt;/strong&gt;&lt;br/&gt;
On opening a web page, client sends a &lt;strong&gt;request&lt;/strong&gt; to the Express app.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Express App --&amp;gt; Client&lt;/strong&gt;&lt;br/&gt;
On request from the client, the web needs to &lt;strong&gt;respond&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The following code adds a &lt;strong&gt;route&lt;/strong&gt; where the app will &lt;strong&gt;respond&lt;/strong&gt; after the user &lt;strong&gt;requests&lt;/strong&gt; to the app with specified path&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;request was sent&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//console.log(req);&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;hello worlddd&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// app responding to client&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;em&gt;res&lt;/em&gt;: response object&lt;ul&gt;&lt;li&gt;You can&amp;#x27;t have more than one res.send(), but normally we&amp;#x27;ll response with a file&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;em&gt;req&lt;/em&gt;: incoming request&lt;ul&gt;&lt;li&gt;Later we&amp;#x27;ll reuse request to send email address&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Every route needs a call back &lt;em&gt;function()&lt;/em&gt; which happens &lt;strong&gt;after&lt;/strong&gt; a function&lt;/li&gt;&lt;li&gt;console.log(req) will give you a detailed information about the request&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;starts-the-server&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#starts-the-server&quot; aria-label=&quot;starts the server permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Starts the server&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Server running on port&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also specify the port in shell with the following:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; process&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token constant&quot;&gt;IP&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Server running&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To run,&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token assign-left variable&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;adding-more-routes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#adding-more-routes&quot; aria-label=&quot;adding more routes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding more routes&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/quiz&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; question &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;What is 1 + 1? 2&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;question&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/rand_num&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;request was sent on rand_num&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Random# between 1 ~ 10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;floor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;random number: &amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Results:&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:838px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:24.186046511627904%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAYAAABFA8wzAAAACXBIWXMAABYlAAAWJQFJUiTwAAAA3ElEQVQY06WNy07CUBRF76c4InFgGFhteBVERPxLB4SHBFTAqvERJ34AUElIDCEhkbYi1Ioj7+0SGodOlJ2s7LPO4BxxP3rnYbzg5nnK1cDmbjij9NgjlSsQ1XRS2Tx7+SPSuUP0ZJrMQQEtliRmZElk9tlNGOzEDba2dTYim4juxOfp9RPLXdC1fSzng86LR828pVhvctK+ptI0w7lyblJbeum0TbV1GVI+uwi9WG9xXG0g+laPqevgzd5w7Qm+N2ediC8pkVKhlCIIAtSSVctw/3fEb1+Cn6P/4Rul0lo8yLfKhgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/73333d962ef7cc93859835a01db72829/a1dd2/2.png&quot; srcSet=&quot;/static/73333d962ef7cc93859835a01db72829/2eb24/2.png 215w,/static/73333d962ef7cc93859835a01db72829/05ed2/2.png 430w,/static/73333d962ef7cc93859835a01db72829/a1dd2/2.png 838w&quot; sizes=&quot;(max-width: 838px) 100vw, 838px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:30.232558139534888%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAABYlAAAWJQFJUiTwAAAA0UlEQVQY06WOyWrCYBSF/8fpQqWNYw11ACn00foWfYDuW6eGxiEOO5VSCk0bbSSKBhXsKsmnv1DpwpU5cDgf93DhiLrpok9/0aw15Y8Z+s+W+4dHIpcJUmqewu0darFEJldELZRQ0uohk9kc8esbovE0ESXFRUzhat+Job1kZLu8OSsGkwXv8w0Dy6H82qLe6vLS7v3jPtWGgWb0qTU7B5bd895PWoOKbiAm1jfjL5PZ1MYyP9msXMJInDr6vo/neWdZyGfpIAiOKSXzj0MvDKMdf9+sJ9NUOa8AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/d0ec6c53e9cb95563e4a7ee85b6997ca/914ae/3.png&quot; srcSet=&quot;/static/d0ec6c53e9cb95563e4a7ee85b6997ca/2eb24/3.png 215w,/static/d0ec6c53e9cb95563e4a7ee85b6997ca/05ed2/3.png 430w,/static/d0ec6c53e9cb95563e4a7ee85b6997ca/914ae/3.png 860w,/static/d0ec6c53e9cb95563e4a7ee85b6997ca/36c33/3.png 946w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;integration-with-mysql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#integration-with-mysql&quot; aria-label=&quot;integration with mysql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Integration with MySQL&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Client --&amp;gt; Express App --&amp;gt; MySQL&lt;/strong&gt;&lt;br/&gt;
With MySQL Node.js Package, the &lt;strong&gt;request&lt;/strong&gt; gets sent from client.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;MySQL --&amp;gt; Express App --&amp;gt; Client&lt;/strong&gt;&lt;br/&gt;
MySQL gives data back(responds) to the app and displays the information to the user.&lt;/p&gt;&lt;h3 id=&quot;connect-to-mysql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#connect-to-mysql&quot; aria-label=&quot;connect to mysql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Connect to MySQl&lt;/h3&gt;&lt;p&gt;Create &amp;amp; Connect to the database. Reference from &lt;a href=&quot;/2019/10/sql-nodejs/#nodsjs-with-mysql-node-package&quot;&gt;this post&lt;/a&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mysql&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; connection &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createConnection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;subscription_db&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;request was sent&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Get # users from query&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SELECT COUNT(*) AS total FROM users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_users &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Number of users: &amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Server running on port&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// connection.end();&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Make sure that your mysql server is running beforehand&lt;/li&gt;&lt;li&gt;It&amp;#x27;s better to send the response &lt;strong&gt;inside the callback&lt;/strong&gt; of query&lt;/li&gt;&lt;li&gt;In a running web server, we &lt;strong&gt;don&amp;#x27;t explicitly end the connection&lt;/strong&gt;. It will end when the server is shut down or when we close the container&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:778px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:52.093023255813954%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAAA60lEQVQoz+WPTUsCURSG7w9y1cJFKNTEVEMTRVD4B1z69yrCnKTCxtQWKuOMDYWWpuZXuhzm6Tom4qoG3HXgue8D5/LCEVdun+vXEUZjKnPMudXm0ulyYXdIJFNEN+Momo5+csqefkxsW5V+hrKvE1N2UQ+O2NEO2VI1IhtRhPUxotYZS76wuxPqn1Oc3oRqa8jtU5X0nYnxUMTIFUjfm5I82XyJTO4x4MYsyiwEPtuL92YDq1LGdWzab03cukNL5ov7zHDQJ+yI2eP/ELjvS5bueV4oxLxgCSvF/or/BfHbh0VhqJPXOf+w8Bsn8O9pG+nbTwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/0125ffacc5c790c72ca4a2c7472ee4e5/20982/1.png&quot; srcSet=&quot;/static/0125ffacc5c790c72ca4a2c7472ee4e5/2eb24/1.png 215w,/static/0125ffacc5c790c72ca4a2c7472ee4e5/05ed2/1.png 430w,/static/0125ffacc5c790c72ca4a2c7472ee4e5/20982/1.png 778w&quot; sizes=&quot;(max-width: 778px) 100vw, 778px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;add-html-with-ejs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-html-with-ejs&quot; aria-label=&quot;add html with ejs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add HTML with EJS&lt;/h2&gt;&lt;h3 id=&quot;bad-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#bad-example&quot; aria-label=&quot;bad example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Bad example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/quiz&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; question &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;strong&amp;gt;What is 1 + 1?&amp;lt;/strong&amp;gt; &amp;lt;em&amp;gt;2&amp;lt;/em&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;question&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Output:
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:836px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:20%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAECAYAAACOXx+WAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAvklEQVQY053J3QrBcBjH8d2MI0WUzOvMKErKdbgHx25HLFqzvMQJLUSJ1rB5OyAcof33s/5O5IynPj1P34eRtBOa6xsk7Yz6/EDJ+gXFUhkefwARPg0hm0MmX0AwxtM7nEghxAng0lm62XgSPjYKl9sLRl0dMTZPmO0vmDpm+yuW5zsGizWqcgui0kW91UOt2aEa7T5tn11U3r+KpICZjFSM1SEOWxPGSsfO2IA8H/h3mO9gO4htgxACy7J+9gKMLw3bxwWGMQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/4feb12cb8d4dec73d8741b79a0fa04b4/27b8e/4.png&quot; srcSet=&quot;/static/4feb12cb8d4dec73d8741b79a0fa04b4/2eb24/4.png 215w,/static/4feb12cb8d4dec73d8741b79a0fa04b4/05ed2/4.png 430w,/static/4feb12cb8d4dec73d8741b79a0fa04b4/27b8e/4.png 836w&quot; sizes=&quot;(max-width: 836px) 100vw, 836px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;install-ejs-package&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-ejs-package&quot; aria-label=&quot;install ejs package permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install EJS package&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;npm i ejs&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;EJS(embedded JavaScript) is a templating language that&amp;#x27;s an alternative to writing plain HTML.&lt;/p&gt;&lt;p&gt;It&amp;#x27;s an HTML that allows to &lt;strong&gt;embed JavaScript&lt;/strong&gt; inside. Regular HTML itself can&amp;#x27;t contain a dynamic variables.&lt;/p&gt;&lt;h3 id=&quot;change-templating-engine&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#change-templating-engine&quot; aria-label=&quot;change templating engine permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Change templating engine&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;view engine&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;ejs&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Change express&amp;#x27; templating engine to ejs.&lt;/p&gt;&lt;h3 id=&quot;create-viewshomeejs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-viewshomeejs&quot; aria-label=&quot;create viewshomeejs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create /views/home.ejs&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Join our Mailing List!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  Would you like to receive mailings from special offers and events?&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  We have &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;123,456&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; people joined our list!&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Your email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    Sign up&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;loads-file-in-request&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#loads-file-in-request&quot; aria-label=&quot;loads file in request permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Loads file in request&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SELECT COUNT(*) AS total FROM users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_users &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;home&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;home&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Look for &lt;em&gt;home.ejs&lt;/em&gt; file inside &lt;em&gt;views&lt;/em&gt; directory (default). Extension is whatever we set previously.&lt;/p&gt;&lt;p&gt;Output:
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:40.46511627906977%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAABYlAAAWJQFJUiTwAAABkElEQVQoz5WQzU8TYRCH9w9SLkZD4MYFSBQQbFSMHrnxB0kIKSoG48fJSGhRT70oBdKW7W63sN0tNMSwW9x2+7nt4zt7aPwIByd58r4z8868Mz8tfeLzxQn4rNgxLkiVPT4en7O8ssrUzF0WHj1l/uETpueWWFx+xuz9BLMLCe4lHjMz/4DJqWlu3Bpn7M4EN29PoFX9BsKPsMdlO+KyFeF6AQd6iSPdZD93jH1+Qc6wRhyquOWcYdouxqlD8aSicGK03Z1PrK895+temr3ULm/fbJM7OuTl5ibJjQ1eJJO83nrF/vdvpFMpPrx/h+s4XGda/eqKoNGg0WwStlqIHw0G8d3zPJphSKVSoV6vx+9+BgG9Xo/hEMXwDwaqTiuVSpimSa1Wo1gsYts21Wo1biIxybmuG/uOmkyQvGVZI1+Qun6/j1YulzEMAzmz2SyZTIZ8Po+u68hnhUIhRnyZstPpxHS73X+QKTVJhmqtllrxd2sqCXzfJ4oi/se0drs9aijFgmghDWUi0Uvsb72u4xe0OjjHxwfWkwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/ee10c9524fa7c7b1dce03b577993f7f5/914ae/5.png&quot; srcSet=&quot;/static/ee10c9524fa7c7b1dce03b577993f7f5/2eb24/5.png 215w,/static/ee10c9524fa7c7b1dce03b577993f7f5/05ed2/5.png 430w,/static/ee10c9524fa7c7b1dce03b577993f7f5/914ae/5.png 860w,/static/ee10c9524fa7c7b1dce03b577993f7f5/d9217/5.png 904w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;pass-in-js-object&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#pass-in-js-object&quot; aria-label=&quot;pass in js object permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Pass in JS object&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;home&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;num&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_users &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Send &lt;em&gt;home.ejs&lt;/em&gt; the data, num&lt;em&gt;users. It will be accessed with _num&lt;/em&gt; in &lt;em&gt;home.ejs&lt;/em&gt;&lt;/p&gt;&lt;h3 id=&quot;usage-to-send-in-multiple-variables&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#usage-to-send-in-multiple-variables&quot; aria-label=&quot;usage to send in multiple variables permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage to send in multiple variables&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;fileName&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;varInEjs&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; varInJS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;varInEjs2&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; varInJS2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;retrieve-inside-homeejs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#retrieve-inside-homeejs&quot; aria-label=&quot;retrieve inside homeejs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Retrieve inside &lt;em&gt;home.ejs&lt;/em&gt;&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;... We have &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&amp;lt;%=num%&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; people joined our list!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the following to access data passed in&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&amp;lt;%=num%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can also insert JavaScript inside&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&amp;lt;%= %&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;in ejs files.&lt;/p&gt;&lt;h2 id=&quot;get--post-requests&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#get--post-requests&quot; aria-label=&quot;get  post requests permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;GET &amp;amp; POST requests&lt;/h2&gt;&lt;h3 id=&quot;get&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#get&quot; aria-label=&quot;get permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;GET&lt;/h3&gt;&lt;p&gt;When you send a GET request&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/quiz&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- ... --&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&amp;lt;/form&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;it will send data to &lt;em&gt;quiz&lt;/em&gt; as GET on submit button. i.e. This will route to /quiz page because we already have &lt;em&gt;app.get()&lt;/em&gt; route for quiz:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/quiz&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;What is 1 + 1? 2&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;-in-url&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#-in-url&quot; aria-label=&quot; in url permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;? in URL&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;https://mysql4613-ugqic.run.goorm.io/quiz?&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You&amp;#x27;ll notice ? at the end of url after submit because no data is being sent. We haven&amp;#x27;t assigned a name to save it under.&lt;/p&gt;&lt;p&gt;Assign the name with the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/quiz&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Your email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    Sign up&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now when you send an email, for example, &lt;a href=&quot;mailto:asd@gmail.com&quot;&gt;asd@gmail.com&lt;/a&gt;, it will append the string on the url.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;https://mysql4613-ugqic.run.goorm.io/quiz?email=asd%40gmail.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Though this appended string may be useful for &lt;strong&gt;searching&lt;/strong&gt; forms, the &lt;strong&gt;standard way of sending data&lt;/strong&gt; from a form adding into database is to &lt;strong&gt;use POST request&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;post&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#post&quot; aria-label=&quot;post permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;POST&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/register&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- ... --&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;method=&amp;quot;POST&amp;quot; action=&amp;quot;/register&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When the form is submitted with the button, it will be a &lt;strong&gt;POST&lt;/strong&gt; request and send it to the router &lt;strong&gt;/register&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;define-route-for-post-request&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#define-route-for-post-request&quot; aria-label=&quot;define route for post request permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Define route for POST request&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/register&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// POST route&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you try going to url /register, that will be a &lt;strong&gt;GET&lt;/strong&gt; request i.e. only way to get to this route is to submit the form.&lt;/p&gt;&lt;h2 id=&quot;body-parser&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#body-parser&quot; aria-label=&quot;body parser permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;body-parser&lt;/h2&gt;&lt;p&gt;body-parser parses the request body. i.e. it&amp;#x27;ll find &lt;em&gt;email=&amp;quot;&lt;a href=&quot;mailto:some@email.com&quot;&gt;some@email.com&lt;/a&gt;&amp;quot;&lt;/em&gt; from the sent POST request. It will return in JavaScript which we can manipulate.&lt;/p&gt;&lt;h3 id=&quot;install-body-parser&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#install-body-parser&quot; aria-label=&quot;install body parser permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Install body-parser&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i body-parser&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;configure&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#configure&quot; aria-label=&quot;configure permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Configure&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; bodyParser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body-parser&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;bodyParser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;urlencoded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;extended&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#appjs&quot; aria-label=&quot;appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mysql&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; bodyParser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body-parser&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Configure app&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;view engine&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;ejs&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;bodyParser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;urlencoded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;extended&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;extract-form-data-from-request-body&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#extract-form-data-from-request-body&quot; aria-label=&quot;extract form data from request body permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extract form data from request body&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/register&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;post request sent to /register: \nReceived: &amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;email&lt;/em&gt; came from ejs file where &lt;strong&gt;&amp;lt;input name=&amp;quot;&amp;quot; ...&amp;gt;&lt;/strong&gt;&lt;/p&gt;&lt;h3 id=&quot;insert-into-database&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#insert-into-database&quot; aria-label=&quot;insert into database permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Insert into database&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/register&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;INSERT INTO users SET ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; err&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Thank you for joining!&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// console.log(result);&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can redirect to home page, app.get(&amp;#x27;/&amp;#x27;..) with &lt;strong&gt;res.redirect(&amp;#x27;/&amp;#x27;);&lt;/strong&gt;&lt;/p&gt;&lt;h2 id=&quot;add-css&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-css&quot; aria-label=&quot;add css permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add CSS&lt;/h2&gt;&lt;h3 id=&quot;create-publicappcss&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-publicappcss&quot; aria-label=&quot;create publicappcss permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create public/app.css&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;css&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-css&quot;&gt;CSS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-css&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Be Vietnam&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; sans-serif&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.05&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.1&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;rem&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;0.4&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;Ivory&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token url function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token url punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token url string url&quot;&gt;&amp;quot;https://i.imgur.com/5cYE4ui.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token url punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; cover&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/*thinner text*/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.form&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;margin-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1.5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-bottom&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#ffffff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token hexcode color&quot;&gt;#94ecd2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Turret Road&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; cursive&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;em&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;transparent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector pseudo-element&quot;&gt;::placeholder&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;LightGray&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;70&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token selector attribute punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token selector attribute attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token selector attribute operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token selector attribute attr-value&quot;&gt;&amp;quot;text&amp;quot;&lt;/span&gt;&lt;span class=&quot;token selector attribute punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token selector pseudo-class&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;outline&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; none&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; solid &lt;/span&gt;&lt;span class=&quot;token color&quot;&gt;white&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color function&quot;&gt;rgb&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;69&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;69&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;69&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1.3&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;em&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color function&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token color&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token color number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token color punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;px&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token selector class&quot;&gt;.flex-container&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; flex&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;justify-content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;flex-direction&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; column&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-connection-in-appjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-connection-in-appjs&quot; aria-label=&quot;add connection in appjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add connection in app.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;__dirname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/public&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Take everything in /public directory and make them accessible by our views.&lt;/p&gt;&lt;h3 id=&quot;add-connection-in-homeejs--google-fonts&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-connection-in-homeejs--google-fonts&quot; aria-label=&quot;add connection in homeejs  google fonts permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add connection in home.ejs &amp;amp; Google fonts&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;stylesheet&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/app.css&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;https://fonts.googleapis.com/css?family=Be+Vietnam&amp;amp;display=swap&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;stylesheet&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;https://fonts.googleapis.com/css?family=Turret+Road&amp;amp;display=swap&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;stylesheet&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- ... --&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;surround-div-in-html&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#surround-div-in-html&quot; aria-label=&quot;surround div in html permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Surround div in HTML&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;flex-container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Join our Mailing List!&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        Would you like to receive mailings from special offers and events?&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        We have&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          &amp;lt;%=num%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;strong&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        people joined our list!&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/register&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;Your email&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;          Sign up&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;appjs-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#appjs-1&quot; aria-label=&quot;appjs 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;app.js&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mysql&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; express &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;express&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; bodyParser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body-parser&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Configure app&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; app &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;view engine&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;ejs&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;bodyParser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;urlencoded&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;extended&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;__dirname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/public&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; connection &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createConnection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;subscription_db&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; path &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SELECT COUNT(*) AS total FROM users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_users &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;home&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;num&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_users &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/register&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; req&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;INSERT INTO users SET ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; err&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Server running on port&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; port&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Scraping]: web scraping imgur.com]]></title><description><![CDATA[Extract information from JSON]]></description><link>https://ellismin.com/2019/10/puppeteer-3/</link><guid isPermaLink="false">https://ellismin.com/2019/10/puppeteer-3/</guid><pubDate>Tue, 01 Oct 2019 00:00:04 GMT</pubDate><content:encoded>&lt;h2 id=&quot;intro&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#intro&quot; aria-label=&quot;intro permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Intro&lt;/h2&gt;&lt;p&gt;I was going to scrape multiple wallpapers images from &lt;a href=&quot;https://imgur.com/a/SU6bL&quot; target=&quot;_black&quot;&gt;imgur website&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;With the strategy learned from &lt;a href=&quot;/2019/09/puppeteer-2&quot;&gt;[Scraping]: Basics&lt;/a&gt;, I&amp;#x27;ve tried to query all image src elements from website.&lt;/p&gt;&lt;p&gt;However, imgur.com uses an &lt;a href=&quot;https://api.imgur.com/&quot; target=&quot;_blank&quot;&gt;API&lt;/a&gt; which doesn&amp;#x27;t show all the images at once, but rather it loads the next page on on scrolling&lt;/p&gt;&lt;h2 id=&quot;inspect&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inspect&quot; aria-label=&quot;inspect permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Inspect&lt;/h2&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:71.16279069767442%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAAC0UlEQVQ4y32U+2/SUBzFm5g9NJsOSl/3tqW0VNpS+qK8pg6QzZGoMbppJhjjI86oUaM/+78fvxfc1MT4w8mll/DhfM/5ghSEMdxmC7bjgVsOqQFur8XoOS4WGBz8gNM8wMbGFejMxOvlEoMsR7/fx63bdzA/PsJsNsNkMoE0tKuwq7vQZRmWqkOpGZAVGzXDhVoPoLgJ5GaO3ZqJjc1tMAKeLJ6jkWeICZpnCeKOUAdJmkJ6FikojB2wG9dQl6vgsgJZ1lCtMVyXObZ3a9jaUUjVFVA3OBYvXsDPUmRJgrzdRodgaZahHceQOr4Dz+awOAMzGDjJYByKqtFpQdcZNM1ATdGwuXUVqqbj46dPyPMcnWTtrN8foFuWSOhZcps+HNeFXXdQbzRgkwzDgGVZcOneNE1wLqBroEKxfPn6FbOjY5S9HoELOvtI0wxR1Ibkex7SQYk7D+ZYvnmFJ4szHDycI+rlaNJ7HknAVFW9BH7+/AXD0T4ycilGLbrlb2AUhnA8F4+WZzh5eorxZIrj08do+D4aDrmu12lsnUbVsLV9bTX6t2/fcUgOi6KLdjtGWZJTei2ylFJqhukGbh3exdsP7/Hy3RuM78+hKgocAjK2HldR1g5FKc8XC4RhRI4i+PTFIZkSCoIAkshIZCYyzGmvxocz9IaDVX4qFSNgQrWasgJqVNJ4PKZNoI3gfCXxpReSGDXKCXqzFSCMOqSYRimpvRQBuRAfEPkJh2JkkeFwOMLe3t6ve+UvSZpagaHLlBUj+9S2zahhnZ45Wi0PtmWuMrwAqrRCo/39FfCirD8ltfNzCHWKcxp5raQ8R0x3UfIWtleCUzEGt3/tIQFHo0ugcPUXMIzvwWtN0QymaEVTBO0p/HBCd3cR9s5QtLooXAKa9fXI1HKP9q9SqfwbeDPw6Y/Bol+FTi4MOo3VyUwG26dcG01E1LbOrcu1Kf8D/An+spHZWMHjqgAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/8d9411a576fb41b6a6cef845e957b542/914ae/1.png&quot; srcSet=&quot;/static/8d9411a576fb41b6a6cef845e957b542/2eb24/1.png 215w,/static/8d9411a576fb41b6a6cef845e957b542/05ed2/1.png 430w,/static/8d9411a576fb41b6a6cef845e957b542/914ae/1.png 860w,/static/8d9411a576fb41b6a6cef845e957b542/48ca3/1.png 1084w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Inspect element (Using Google Chrome). Then move to the &lt;strong&gt;Network&lt;/strong&gt; tab and select &lt;strong&gt;XHR&lt;/strong&gt;.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;XHR&lt;/strong&gt; filter shows the type of &lt;strong&gt;HMLHttpRequest&lt;/strong&gt; that&amp;#x27;s built with JavaScript, and it sends the request on loading images.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Browser over to the name of the requests and take a look at &lt;strong&gt;JSON&lt;/strong&gt; file.
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:727px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:80%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAAsTAAALEwEAmpwYAAACoElEQVQ4y3VUS0/bYBD0vYioiR078fsVP+O8iiBCXEggygG1gl5a1Jbm0FOv/f3T2S8xCtAeRp+tbz07O7tr7cv9PZIwRJ3nqKsKecFzPEZVZkSOIAjheR5y3hdFgdFopM4kSVCWJeI4ZkwA3/dRJSm0z3d3cAcDRPzIdRx4vMiyHLPZBA2Jx+MGi/kCJZNlJC3LClVVkzhTcUVRqrucSQIK07afPqJPEpuZBn6AOIkxtIeIohiO68I/ZJfnMIxg2w5VJRgOhwiiCC7vVAwxsCxom+0WndCDHgawqXTk2rDMPrrdLnq9Hnq6jp6h758JXdefT4FhGNAP7/KsPTw8wJVyJQvPKPAReD5V2uj3+1RkK78iqhG/oig8IFLeOrTJpfoW2s/djmUmsChXSAZUOWA5TdNgMpkoMmmEeCQojk7xcJRl6j5NU5VQe3x8RJJmiNMRGxLQKw+mNcB8PseWdlyvrrG8vCT5VDWo4TmdzQ6YYzqdMfmEjapUcu3p+zdMxjXKLEUSeIh9F0PTYOAUN+sbXK2ucLY833e3rpUyKVnUtEiSWJGJSu3p9x+MV/cwZitiTdzgfX6uPl4ul7g4v1DqZlQ8X3xQaGjF3s/oDbSvu18YLS4RTpZw6zM41RnMuFQzJRnFHxkZaZBJn1uP5f1f0H6w5HFdsbMOLKMHU++iT0gH281ISCzbIB+0IyPPMiavocbG53pFHFaX42KaFgwGh1QoRsvpHYZXlHqMEZUt6RuF6/UaJyfv9gN6GE5BO3/7cdhvhsXuyymEMmatyheEm80GnU7nOaANkhJlDkVlwZ9Azp1Nub+i1nFkiD3Gmm8Jb29vcXp6ylLNF4Syvyn9C7i/Ykd42G3Z5eNqXqv8L6E0RUoWNe3dMclx7PH7X6a9wNzHInqNAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/8e301b8cd43604be7651a892135f502f/c54b3/2.png&quot; srcSet=&quot;/static/8e301b8cd43604be7651a892135f502f/2eb24/2.png 215w,/static/8e301b8cd43604be7651a892135f502f/05ed2/2.png 430w,/static/8e301b8cd43604be7651a892135f502f/c54b3/2.png 727w&quot; sizes=&quot;(max-width: 727px) 100vw, 727px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;This contains the URL where all the name of the images are stored. Let&amp;#x27;s open the link to retrieve JSON data.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;https://imgur.com/gallery/SU6bL/comment/best/hit.json&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;getting-data-from-json-file&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#getting-data-from-json-file&quot; aria-label=&quot;getting data from json file permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Getting data from JSON file&lt;/h2&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:84.65116279069768%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAABYlAAAWJQFJUiTwAAAC9UlEQVQ4y02UWW+jQBCE+Ss2xthcgwGDDU7sXa32l+eS8pb7vu87UfKSKKrtai9WHloDI+ajuqt7rJubG5ydneHk5ARXV1d4f3/H29ubxsPDA76+vrC4uIiqqjAYDDCZTBAEARqNBowxGI/H6Pf7GA6HKMsSFmE7Ozs4Pj7WdXNzU9fz83Pd+/j4wOrqKkajkUZRFEjTVIM/yPMcvV4PcWwwkp9aPHx6eord3V0cHBxoEErFh4eHuL+/x9LSEjJRUY3mBDKUw7GoDOH7AXxZg3AafLeogrG3t6cABqH8EYMlYcpJkoiaWNRE+mzCDkzUQRzI6nv67HsuLAK2t7f18MbGhoLX19exv7+Pra0thRMYioIyGyA2sdbOREaeJaIIWVIiknfXdaZApluvBBFK1dy7vb3FwsICmnYTg3CIvp/LwTZC3xdFPjrdLroaHjzPg1Wru7y8VAgV8fni4kLfPz8/sbKygkazgciNMDG/kQQp8nYLadtBq9WC3WzCtm0Ni8VnEECFdJ3tw3c6TZeXl5f/Aw3+JH8VGLfbMG4HtgBbP8KqW4Vprq2tKZCuM10qfX5+nqUcuiHG0QSjYA5lMEBqRnCctiqbAY+OjhRAUO1yXVP+5O7uTtumKWl5rqcpD+NK6uULwJmlOkuZNeRBrnSXzhJY7zF1usyPHcdB1atkIir8MRGqrrSM9GQkZrDROTHq8vX19WxS6DJVUTHV142tadktaZNYp2NODKnE3R57UhzPBVbI5FgsfK2INeQzIWxoOv709DRTyBolJtXxm++4qDodbfJYgP0s031VSFU8TCiBjLqF6PgsZalZnuQ6078FOO91kYnaJAxQyuXAfYswBqeE9WMLsQSPj494eXnB9/e3to0tLlNhZjLkxQClAMeikCnHcvuoQqZMh6mG0Dp17rF+/AlL8jPlLMrQzwtUou6XTAyBPQGmOuv5VGGdZn3j0BDW7vX1VSdlqnAKLGJRV40wkQthIsBUlKUyz4XASrm+/gGMqWgQVGULRQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/303b631d94a2c9ecb72f58b41c88002b/914ae/3.png&quot; srcSet=&quot;/static/303b631d94a2c9ecb72f58b41c88002b/2eb24/3.png 215w,/static/303b631d94a2c9ecb72f58b41c88002b/05ed2/3.png 430w,/static/303b631d94a2c9ecb72f58b41c88002b/914ae/3.png 860w,/static/303b631d94a2c9ecb72f58b41c88002b/46115/3.png 1290w,/static/303b631d94a2c9ecb72f58b41c88002b/e4ee8/3.png 1496w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Open the console and type in the following to parse the JSON file.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Looking at the parsed data, you will see images are stored under data -&amp;gt; image -&amp;gt; album_images -&amp;gt; images&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:69.76744186046511%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAACrklEQVQ4yz1T104jQRDc7wBjdPaxThu9OXht69D9Nji88AQIkXMQOcMbgrqu4RZLrelZa2qqumq0s7MznJ6e4uDgAC8vL3h7e/upj48PjMdjeJ6HPM8xGAxgWRbq9TpM00S/30cYhhgOh8iyDFEUQTs/P8fOzg6Ojo6wu7uLra0tbG9vY3NzE8/Pz1hZWYHruiiKQh0mOCuOY7Xnf3EcCWCq9hrB9vf3FSD7vb09tW5sbODx8RGTyQSGYaDoD5EkKRzHFXaWfDPValm2Yuv7gVzkQyPY4eGhks3+5OQEx8fHCpQMp9MpdF1HHLlwbEMABcRswOjo6LSkmjrabR2uYwh4B9r6+rqSSgBKpWT2q6ureHh4wPJohGZzAX+GIYrclwrQ77nCyIJtGXAtUy4x1WWG0YJGdgQiwxKMF1Dy/f09lpaWUKvVZUY9mVGEgBVEYkCMJE3VLFmp9LbtQKO7a2trCog9gUumr6+vGE/GqP2qKVMSHhQDYnFTgSSJuC/f01wY+yoB2sXFBe7u7hQbrnT98vISNzc3+Pr6wmQ6QbVSRS8rEAUB/nbayBwHvvSBrJkARlGqjFGAV1dXys3b21tcX1/j6elJZZB7/mhKZaaCUGT6AjBY+I1AQG3pnU5HMWOMCGbbNjTOqixmjzNlhCj//f0do/EI1dmqyMsR+x4WxfHUNNAVEF9YUToDTTBHLtF4mNljVNhzpSkEp+zl0TLmK/PIRXIS+AK4gESACOgJq/S/MQx4t9v9NoWHCcocck9AGkX5fHpzs3PIQg7ew0AY5iLVlcOuBD6Moh+GSnIJxDdd5q+UzDmSYUUAYy9R8yoaOrJWE44A2u02PPnGJ0dT+KJUDulqKZVuMy6fn5/KFD69yswcemFPxWWx0UDWbsETlz1hSnbfGfx+gv8AqcW3205jkEMAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/5c1b73e75da60a19e3398d1d4a755d46/914ae/4.png&quot; srcSet=&quot;/static/5c1b73e75da60a19e3398d1d4a755d46/2eb24/4.png 215w,/static/5c1b73e75da60a19e3398d1d4a755d46/05ed2/4.png 430w,/static/5c1b73e75da60a19e3398d1d4a755d46/914ae/4.png 860w,/static/5c1b73e75da60a19e3398d1d4a755d46/46115/4.png 1290w,/static/5c1b73e75da60a19e3398d1d4a755d46/0d390/4.png 1472w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Type in the following to get these images&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;album_images&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;images&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:846px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:70.23255813953489%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAACKUlEQVQ4y61T2ZKbQAzkW8I1DGCwMae5fOEjtrObbPKS//+OTmvM1m6lKm956FLrQGqNbEtrjaLIUJYl6jJE32Y4n48YugT9JsF2bHHYj2jqAmMXEQsMbYymWaIt19hVGfIsNfV1mcDyPA/Xy4jT1OFxTdH2Gbp2YZrXpUaziU1xvg4xDjHyPELXRIiyHGEzIiWSVYKmpaCmgRUEAdIkRUVnnUTYK4WN40IRK6IjUttFTDvQVq4HT6zjoHdsJAYOtkRs27Bc30fiMhBFuLD5iw6wDzUutD/DAPeInLjTP2mFac5dWSv8GIa4BQqvEmcPy+HEiN0n5aMSMHklpHlBuyXuRCnKGbuQH8QnjvQP/KYwOYUdxVk23zClwpoTRgbfOP1IngeBafyNfq4/cqK+YE7igow5Gf6b8Y6+5Xo+llIwKxMVouCFaDl9YNF3YqIKUbJn/KvUkbeslSFn+rV8Lw0dUUj0TGZKmZVOwml74geLZEg5rzuwZkVM+ilCVq+Yu9GvfO/ZUN5wR8nyuJIQPrHoVd6L/pZriWI5xoVHkMO9Ga6ZC/Aw76lwjsKPhrJuJ4cQlep5lIbYkZ/MwWTF57qydi4qZSBzwresHd4VLj0Xa6qQFX/Jm1BFqp7rPojVp6P05LLyTY5Gf2HePDDf1fKzUTqG1iEcqlSui4DwCHf2feFzXLhjrGO4N+f8d1Ac/3o+bNshbHyZYc/4m3/2/wXzXxYiCv8H/gDSlbB5eT/lPwAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/72dedab7b7d64afa85c806af94ee5633/5b481/5.png&quot; srcSet=&quot;/static/72dedab7b7d64afa85c806af94ee5633/2eb24/5.png 215w,/static/72dedab7b7d64afa85c806af94ee5633/05ed2/5.png 430w,/static/72dedab7b7d64afa85c806af94ee5633/5b481/5.png 846w&quot; sizes=&quot;(max-width: 846px) 100vw, 846px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Then map it into array with the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;album_images&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;imageName&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imageName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now we have extracted image names. Let&amp;#x27;s use puppeteer to download these images&lt;/p&gt;&lt;h2 id=&quot;on-puppeteer&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#on-puppeteer&quot; aria-label=&quot;on puppeteer permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;On Puppeteer&lt;/h2&gt;&lt;h3 id=&quot;test-the-array&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#test-the-array&quot; aria-label=&quot;test the array permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test the array&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;scrapeJSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Open the browser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;headless&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://imgur.com/gallery/SU6bL/comment/best/hit.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; content &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  imageNames &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;album_images&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;imageName&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imageName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;imageNames&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;scrapeJSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgurScrape.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hNmDF6p&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;7SrF82H&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hPayG82&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We obtained the image names. Let&amp;#x27;s create the urls on top of &lt;strong&gt;&lt;em&gt;downloadImage()&lt;/em&gt;&lt;/strong&gt; function from the &lt;a href=&quot;https://ellismin.com/2019/09/puppeteer-2/#downloading-images-in-page-as-file-request-module&quot; target=&quot;blank&quot;&gt; last post&lt;/a&gt;.&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Be sure to have request module available.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlPrefix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://i.imgur.com/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlAffix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Create url form arr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlPrefix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlAffix&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;imgurscrapejs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#imgurscrapejs&quot; aria-label=&quot;imgurscrapejs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;imgurScrape.js&lt;/h2&gt;&lt;p&gt;Whole code snippet:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;puppeteer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;downloadImage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; imgPrefix&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fs &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;fs&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    request &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;request&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;download&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; filename&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    request&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createWriteStream&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;close&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlPrefix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://i.imgur.com/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlAffix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Create url form arr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlPrefix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; urlAffix&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Test downloading one image&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// download(arr[0], &amp;quot;test.png&amp;quot;, function(){&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//   console.log(&amp;quot;image created!!&amp;quot;);&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// });&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// download images with url&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgName &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgPrefix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;download&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;image created!&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;scrapeJSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Open the browser&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;headless&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://imgur.com/gallery/SU6bL/comment/best/hit.json&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; content &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  imageNames &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;body&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;album_images&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;imageName&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imageName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// console.log(imageNames);///&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;downloadImage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;imageNames&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;wallpaper-&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Run&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;scrapeJSON&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;result&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#result&quot; aria-label=&quot;result permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Result&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:180px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:169.44444444444443%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAiCAYAAABfqvm9AAAACXBIWXMAAAsTAAALEwEAmpwYAAADzklEQVRIx42WaVciRxSG/RljxF2WRqCh2deQYRjUxA1k08F11BEVhRxzcjR/IfnLb+q92gxtN8iHOgVFU/XUU/fe6hlN8yOdzmBlZVVaMBgEx1ZX1+B2e7C25rb0brcb8/MLmJtzweWyt5lUKo293V1EIgYuLi7Q6z3g+/dLPD09odu9RbPZRDyewK565vj4BDc3XcRicXz6NIuFhUWZfLTN+PzrSGSyWF5eEYpgMIRA4JXS6/XJmM/nU00TwlBIl52QkBO4XPOWNlP+Wsbfz38hHI7g9PQUt7e3ODs7x+PjI66urlGr1VAqfUG1WkO7fShj0WhMCN/TvRIqCkNtl6uSiFtnIylpSOVXu+AYqdnTr0lomzBixJBI52EYUZyfn+P+vqf6CwwGfypfNzg4qKNS2UCj0cTR0TdcX39AqAcD2PictzkkFd1xjOTr64Ghw4mEpVwO3cYBwmorrw7vxOHDw6PQ0N3m5hbq9YZy2P7YIVc3VBhYHUaElI1UdEeyqRwm4jFsfCkoh4ajw3q9ju3tHXXaB9M59Cs32WzB0aEZhyTjd9LqengyYbmyicHzCyLDOLQ7pD9mTKs1pcOIeoCE/MwAZwuFrHHIsNI0TfqJhIbK09TnsgQ33dEhc3owGODHjxshSyZTyuM2Op3jN8LoeEKPxwtdkTjHoTZ0yDaVQ66+UanIVk5OnBxW5aRbrdZ0DkmSzhffHHpHHOpDh8wSM5e5MKnHEuYzafzR6IA5zTjs9X46ZO1jLjMGm82WxCEJOalJyJJlP2Vdx9LS8liHpEwmk+KOpPQ+ljCXy6Oqah4ftDp8UDRXQsiqTkKS0iPdctHZ2V/sE2qacpjJOcShLrFIGv5m5rYZkxx7v12ZMKUmqzbbw1w2Hfb7P+OQl1ixWJSc5r3CO4cH5UjodnvVyoZa0eqQfxh1aDrlZ+5gLGEmU0SteiaZMuqQtx8dMgYZqzs7u9jb28fh4dFkQrmXlfRRh6yHZhyaDnlozBI+H33L/bk5B8J0KovtrerwTiGZ1WFLnXJKTput0+kIIRU4Eq7RT8Cey6MO2fjdrIkTHcbiWRTKbdnGe4eXl1dSC+mQPe/oDx36lZN8LmdzqOumQ4/8Rn+ktzp0OcShOpBadV8cmmSsi/1+3xKHJNvfr0pNnOiQd0omV7DkMt/A3js033fokCc+lrBU+qresgbDenh3d29zyF1wjPfLhw49isJIpCyE9GWeNMcWF5eEKhwOS82c6PA3VUFO//tXvQPG5YRfXv5RxF08q5uQsUjqQuFXbG39Lg5ZD0k+zuH/xORTjx4IPwUAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/af36d896269fecd58ebc3c7feff2a999/e9ff0/6.png&quot; srcSet=&quot;/static/af36d896269fecd58ebc3c7feff2a999/e9ff0/6.png 180w&quot; sizes=&quot;(max-width: 180px) 100vw, 180px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Node pkg]: Generate Random Data with Faker]]></title><description><![CDATA[Faker is efficient in generating random data with Node JS]]></description><link>https://ellismin.com/2019/10/faker/</link><guid isPermaLink="false">https://ellismin.com/2019/10/faker/</guid><pubDate>Tue, 01 Oct 2019 00:00:03 GMT</pubDate><content:encoded>&lt;a href=&quot;https://github.com/marak/Faker.js/&quot; target=&quot;_target&quot;&gt;Faker documentation (Node.js)&lt;/a&gt;&lt;h3 id=&quot;installation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;&lt;p&gt;Use Node Package Manager to install Faker&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;usage-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#usage-example&quot; aria-label=&quot;usage example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Usage Example&lt;/h3&gt;&lt;p&gt;main.js&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;faker&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// import package&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; randEmail &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;internet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;randEmail&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Earline_Gusikowski92@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Myriam_Nicolas83@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Jalen_Towne@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Thurman_Wintheiser@yahoo.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Valentin_Friesen49@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Christian.Ondricka94@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Jacklyn.Graham0@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Horacio_Dibbert@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Imogene.Ratke@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Lee_Kuhic@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Reinhold_Walsh@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Henderson.Wisozk78@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Jakob6@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Rupert64@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Linnea_Reinger@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Marilou.Ratke@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Jerrod_Bins@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Ruthie.Armstrong@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Grover64@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Keith_Goyette17@hotmail.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Returns random 20 emails&lt;/p&gt;&lt;h3 id=&quot;random-date&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#random-date&quot; aria-label=&quot;random date permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Random date&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;faker&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;past&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;2018-10-14T17:35:04.919Z&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;random-address&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#random-address&quot; aria-label=&quot;random address permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Random Address&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;faker&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;streetAddress&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;city&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;, &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;zipCode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;3982 Nitzsche Via&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Bednarbury&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;North Dakota, 21930&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[MySQL with Node.js]]></title><description><![CDATA[Working with MySQL in Node.js]]></description><link>https://ellismin.com/2019/10/sql-nodejs/</link><guid isPermaLink="false">https://ellismin.com/2019/10/sql-nodejs/</guid><pubDate>Tue, 01 Oct 2019 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;MySQL is common with PHP, C++, Node, Java, Python, Ruby, and so on. In this post, we&amp;#x27;ll work out Node.js.&lt;/p&gt;&lt;h3 id=&quot;nodejs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#nodejs&quot; aria-label=&quot;nodejs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Node.js&lt;/h3&gt;&lt;p&gt;Client requests --&amp;gt; NodeJS --&amp;gt; MySQL DB&lt;br/&gt;
MySQL DB --&amp;gt; NodeJS --&amp;gt; Client (any device)&lt;/p&gt;&lt;p&gt;Unlike JavaScript which modifies contents on the client side, Node.js is an interpreter and environment for JS with useful libraries that works on the server side. Node JS only runs in V8 engine(mainly by Google Chrome) while JS runs in Spider monkey(Fire Fox), Java Script Core(Safari), and V8.&lt;/p&gt;&lt;h2 id=&quot;nodsjs-with-mysql-node-package&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#nodsjs-with-mysql-node-package&quot; aria-label=&quot;nodsjs with mysql node package permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Nods.js with MySQL (Node package)&lt;/h2&gt;&lt;a href=&quot;https://github.com/mysqljs/mysql&quot; target=&quot;_blank&quot;&gt;Documentation on Github&lt;/a&gt;&lt;h3 id=&quot;installation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#installation&quot; aria-label=&quot;installation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Installation&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;import-in-js&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#import-in-js&quot; aria-label=&quot;import in js permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Import in js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mysql&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;get-host-name-cloud-server&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#get-host-name-cloud-server&quot; aria-label=&quot;get host name cloud server permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Get host name (cloud server)&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; @&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;@hostname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SHOW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; VARIABLES &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; Variable_name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;%host%&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Variable_name                 | Value |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| host_cache_size               | 279   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| hostname                      | goorm |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| performance_schema_hosts_size | -1    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| report_host                   |       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When needed, you can get hosts for all incoming requests&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; host &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; information_schema&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;processlist&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| host      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| localhost |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;get-user-name&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#get-user-name&quot; aria-label=&quot;get user name permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Get user name&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CURRENT_USER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CURRENT_USER() |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| root@localhost |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;connect-to-mysql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#connect-to-mysql&quot; aria-label=&quot;connect to mysql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Connect to MySQL&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;mysql&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; connection &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; mysql&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createConnection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;root&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;subscription_db&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ... codes&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// end connection&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make sure to &lt;strong&gt;end connection&lt;/strong&gt; with &lt;strong&gt;connection.end()&lt;/strong&gt;&lt;/p&gt;&lt;h3 id=&quot;run-queries&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#run-queries&quot; aria-label=&quot;run queries permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Run queries&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SELECT 2 * 9 AS res&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query2 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SELECT CURTIME() as time, CURDATE() as date, NOW() as now&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;query2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ node main.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;[ RowDataPacket { res: 18 } ]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;RowDataPacket { res: 18 }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;18&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;[ RowDataPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    time: &amp;#x27;07:00:11&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    date: 2019-10-02T00:00:00.000Z,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    now: 2019-10-02T07:00:11.000Z } ]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;07:00:11&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;2019-10-02T00:00:00.000Z&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;2019-10-02T07:00:11.000Z&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;function() is a &lt;strong&gt;call back&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;results returns all data in an array, &lt;strong&gt;[]&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;work-with-created-database&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#work-with-created-database&quot; aria-label=&quot;work with created database permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Work with created database&lt;/h2&gt;&lt;h3 id=&quot;create-database-in-mysql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#create-database-in-mysql&quot; aria-label=&quot;create database in mysql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Create database in MySQL&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATABASE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; subscription_db&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;USE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; subscription_db&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    email &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;tera11@gmail.com&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;gogo@hotmail.com&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;test-with-js&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#test-with-js&quot; aria-label=&quot;test with js permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test with js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SELECT * FROM users&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ node main.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;[ RowDataPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    email: &amp;#x27;gogo@hotmail.com&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at: 2019-10-02T07:55:34.000Z },&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  RowDataPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    email: &amp;#x27;tera11@gmail.com&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at: 2019-10-02T07:55:34.000Z } ]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;RowDataPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  email: &amp;#x27;gogo@hotmail.com&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  created_at: 2019-10-02T07:55:34.000Z }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;RowDataPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  email: &amp;#x27;tera11@gmail.com&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  created_at: 2019-10-02T07:55:34.000Z }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;tera11@gmail.com&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;getting--users&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#getting--users&quot; aria-label=&quot;getting  users permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Getting # users&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;SELECT * FROM users&lt;ul&gt;&lt;li&gt;Retrieve with &lt;strong&gt;results.length&lt;/strong&gt; (&lt;strong&gt;not recommended&lt;/strong&gt;)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;SELECT COUNT(*) AS total FROM users&lt;ul&gt;&lt;li&gt;Retrieve with &lt;strong&gt;results[0].total&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;insert-with-node&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#insert-with-node&quot; aria-label=&quot;insert with node permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Insert with Node&lt;/h2&gt;&lt;h3 id=&quot;hard-coded-not-recommended&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#hard-coded-not-recommended&quot; aria-label=&quot;hard coded not recommended permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Hard coded (not recommended)&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; query &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;INSERT INTO users(email) VALUES (&amp;quot;someemail@naver.com&amp;quot;)&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ node main.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;OkPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  fieldCount: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  affectedRows: 1,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  insertId: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  serverStatus: 2,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  warningCount: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  message: &amp;#x27;&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  protocol41: true,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  changedRows: 0 }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;what-you-want-to-do&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-you-want-to-do&quot; aria-label=&quot;what you want to do permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What you want to do&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;testing@aa.com&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;INSERT INTO users SET ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;br/&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;var var_name = {key: data_type, key2: data_type, ...};&lt;/li&gt;&lt;li&gt;&lt;strong&gt;SET ?&lt;/strong&gt; dynamically adds the data&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;insert-fake-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#insert-fake-data&quot; aria-label=&quot;insert fake data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Insert fake data&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;faker&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;internet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;past&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;INSERT INTO users SET ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note: return value of faker.data.past() isn&amp;#x27;t compatible with MySQL; however, MySQL in Node.js is smart enough to &lt;strong&gt;convert it to MySQL format (yyyy-mm-dd hh:mm:ss)&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;mysql-connection-as-variable&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#mysql-connection-as-variable&quot; aria-label=&quot;mysql connection as variable permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MySQL connection as variable&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;//...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;internet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;past&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;INSERT INTO users SET ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token parameter&quot;&gt;  results&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;sql&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;{ email: &amp;#x27;Gregorio.DAmore64@hotmail.com&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  created_at: 2019-08-08T18:21:06.815Z }&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;INSERT INTO users SET `email` = &amp;#x27;Gregorio.DAmore64@hotmail.com&amp;#x27;, `created_at` = &amp;#x27;2019-08-08 18:21:06.815&amp;#x27;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;OkPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  fieldCount: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  affectedRows: 1,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  insertId: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  serverStatus: 2,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  warningCount: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  message: &amp;#x27;&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  protocol41: true,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  changedRows: 0 }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;res.sql&lt;/strong&gt; shows the sql query inserted. Note that &lt;strong&gt;2019-08-08T18:21:06.815Z&lt;/strong&gt; was converted to 2019-08-08 18:21:06.815.&lt;/p&gt;&lt;h2 id=&quot;bulk-insert&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#bulk-insert&quot; aria-label=&quot;bulk insert permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Bulk insert&lt;/h2&gt;&lt;h3 id=&quot;inserting-multiple-users&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inserting-multiple-users&quot; aria-label=&quot;inserting multiple users permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Inserting multiple users&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;sotto@gmail.com&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;2018-09-27&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;abc@ato.com&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;2019-02-22&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;heyman@yahoo.com&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;2019-03-01&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;INSERT INTO users (email, created_at) VALUES ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;[ppl]&lt;/strong&gt; is used as parameter&lt;/p&gt;&lt;h3 id=&quot;test-the-data-with-faker&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#test-the-data-with-faker&quot; aria-label=&quot;test the data with faker permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test the data with faker&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_add &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;internet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;past&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;/// check data&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ node main.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Elmer_Auer29@gmail.com&amp;#x27;, 2019-09-24T23:24:55.864Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Hallie88@yahoo.com&amp;#x27;, 2019-06-12T15:08:56.010Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Drew63@gmail.com&amp;#x27;, 2019-03-24T13:36:13.934Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Hailey11@hotmail.com&amp;#x27;, 2018-12-30T10:46:25.695Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Rosalia_OKon92@hotmail.com&amp;#x27;, 2019-04-29T09:38:46.102Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Glenna73@yahoo.com&amp;#x27;, 2019-09-16T23:34:40.805Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Jaida_Feeney@yahoo.com&amp;#x27;, 2018-11-15T22:43:19.552Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Elouise.Wehner46@yahoo.com&amp;#x27;, 2019-09-17T02:24:26.731Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Jamaal.Koch45@hotmail.com&amp;#x27;, 2019-03-08T06:57:48.539Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Jimmie_Hermiston15@gmail.com&amp;#x27;, 2019-08-09T17:02:42.409Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Mariane_Gorczany@hotmail.com&amp;#x27;, 2019-06-18T11:36:39.618Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Laverne.Lynch@gmail.com&amp;#x27;, 2019-01-24T17:21:49.967Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Robert_Dooley@yahoo.com&amp;#x27;, 2019-07-20T09:30:36.802Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Ramona54@gmail.com&amp;#x27;, 2019-09-11T09:01:48.108Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Jaron35@yahoo.com&amp;#x27;, 2019-06-10T05:24:39.850Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Viva.Goyette35@gmail.com&amp;#x27;, 2019-01-16T17:13:52.463Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Savanna.Brakus38@hotmail.com&amp;#x27;, 2019-05-20T22:35:40.538Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Drew47@hotmail.com&amp;#x27;, 2019-07-02T16:31:43.440Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Verla_Jenkins84@gmail.com&amp;#x27;, 2018-10-23T06:23:07.751Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Jan.Zulauf63@gmail.com&amp;#x27;, 2019-05-24T00:50:27.236Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Jerry.Lakin93@gmail.com&amp;#x27;, 2018-11-19T06:49:13.985Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Dave.Sipes@yahoo.com&amp;#x27;, 2019-09-25T05:40:37.278Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Delphia.Rath@hotmail.com&amp;#x27;, 2019-06-09T00:57:04.997Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Annamarie60@yahoo.com&amp;#x27;, 2019-04-03T18:03:12.261Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Charlie_Fadel79@gmail.com&amp;#x27;, 2018-10-17T12:41:17.869Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Dallin_Murphy@gmail.com&amp;#x27;, 2019-06-19T09:59:09.289Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Daija22@gmail.com&amp;#x27;, 2019-08-07T14:15:06.439Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Denis.Mayer@gmail.com&amp;#x27;, 2019-02-05T02:08:18.620Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Elijah38@hotmail.com&amp;#x27;, 2019-05-23T03:00:00.608Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Aaliyah.Gorczany89@hotmail.com&amp;#x27;, 2018-11-22T12:12:06.693Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  [ &amp;#x27;Otho_Streich66@gmail.com&amp;#x27;, 2019-09-03T21:37:31.277Z ],&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ... 400 more items ]&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;insert&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#insert&quot; aria-label=&quot;insert permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Insert&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_add &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_add&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;internet&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; faker&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;past&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// console.log(ppl); /// check data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;INSERT INTO users (email, created_at) VALUES ?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ node main.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;null&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;OkPacket {&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  fieldCount: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  affectedRows: 500,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  insertId: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  serverStatus: 2,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  warningCount: 0,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  message: &amp;#x27;(Records: 500  Duplicates: 0  Warnings: 0&amp;#x27;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  protocol41: true,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  changedRows: 0 }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;retrieve-data-with-mysql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#retrieve-data-with-mysql&quot; aria-label=&quot;retrieve data with mysql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Retrieve data with MySQL&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;&lt;p&gt;Find the earliest date a user joined&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Find email of the first user&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;number of users followed by month order by num users in descending order&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Get number of yahoo emails&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Calculate Total number of users for each email host&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q1 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;SELECT DATE_FORMAT(created_at, &amp;quot;%M %D %Y&amp;quot;) AS &amp;quot;earliest_date&amp;quot; FROM users ORDER BY created_at LIMIT 1&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q12 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;SELECT DATE_FORMAT(MIN(created_at),&amp;quot;%M %D %Y&amp;quot;) AS earliest_date FROM users&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// won&amp;#x27;t work if there are multiple records with same created_at value&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// var q2 = &amp;#x27;SELECT email, created_at FROM users ORDER BY created_at LIMIT 1&amp;#x27;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q2 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;SELECT * FROM users WHERE created_at= (SELECT MIN(created_at) FROM users)&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q3 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;SELECT DATE_FORMAT(created_at, &amp;quot;%M&amp;quot;) AS month, COUNT(*) AS cnt FROM users GROUP BY month ORDER BY cnt DESC&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// var q32 = &amp;#x27;SELECT MONTHNAME(created_at) AS month, COUNT(*) as count FROM users GROUP BY month ORDER BY count DESC&amp;#x27;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q4 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;SELECT COUNT(email) AS yahoo_users FROM users WHERE email LIKE &amp;quot;%@yahoo.com&amp;quot;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; q5 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;SELECT CASE WHEN email LIKE &amp;quot;%gmail.com%&amp;quot; THEN &amp;quot;gmail&amp;quot; WHEN email LIKE &amp;quot;%yahoo%&amp;quot; THEN &amp;quot;yahoo&amp;quot; WHEN email LIKE &amp;quot;%hotmail.com%&amp;quot; THEN &amp;quot;hotmail&amp;quot; ELSE &amp;quot;other&amp;quot; END AS  provider, COUNT(*) FROM users GROUP BY provider&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;q5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; results&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fields&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;throw&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; error&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[SQL]: cloning Instagram Database]]></title><description><![CDATA[Common entities on Instagram: USERS, PHOTOS, COMMENTS, HASHTAGS, LIKES, FOLLOWERS/FOLLOWEES, ... Tables It's possible to make username a…]]></description><link>https://ellismin.com/2019/09/sql-igdb/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-igdb/</guid><pubDate>Mon, 30 Sep 2019 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;Common entities on Instagram: USERS, PHOTOS, COMMENTS, HASHTAGS, LIKES, FOLLOWERS/FOLLOWEES, ...&lt;/p&gt;&lt;h2 id=&quot;tables&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#tables&quot; aria-label=&quot;tables permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Tables&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    username &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;UNIQUE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    image_url &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    user_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    comment_text &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    photo_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    user_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    user_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    photo_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; follows &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    follower_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    followee_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;follower_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; followee_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tags &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    tag_name &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;UNIQUE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_tags &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    photo_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    tag_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;tag_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tags&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tag_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;It&amp;#x27;s possible to make username a primary key, but it may be slow when string is too long. Better practice to still include the id&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;PRIMARY KEY(user_id, photo_id) in likes prevent from a user to make a multiple likes&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;PRIMARY KEY(follower_id, followee_id) &lt;s&gt;to prevent following oneself&lt;/s&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;THIS actually does not prevent! &lt;a href=&quot;/2019/10/sql-triggers/&quot;&gt;Try using trigger&lt;/a&gt; to prevent this.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;PRIMARY KEY(photo_id, tag_id) in photo_tags table prevents multiple instances of photo tag&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;hash-tag-implementation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#hash-tag-implementation&quot; aria-label=&quot;hash tag implementation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Hash tag implementation&lt;/h2&gt;&lt;h3 id=&quot;1-creating-tag-column-in-photos&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-creating-tag-column-in-photos&quot; aria-label=&quot;1 creating tag column in photos permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Creating tag column in photos&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+---------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | url      | caption      | tags                            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+---------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | /dociv32 | Madison      | #capitol#summer#omg#daily       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | /39dksje | My dog       | #dog#frese#joy#happy            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | /kfeiw2  | selfie today | #selfietoday#happy#sad#handsome |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+---------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Easy to implement. However, this design..&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Limits # tags that can be stored&lt;/li&gt;&lt;li&gt;Each tag can&amp;#x27;t have additional information stored&lt;/li&gt;&lt;li&gt;Searching for tags can be a hassle&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;2-using-2-tables&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-using-2-tables&quot; aria-label=&quot;2 using 2 tables permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Using 2 tables&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;photos:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | url      | caption      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | /dociv32 | Madison      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | /39dksje | My dog       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | /kfeiw2  | selfie today |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;tags:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| tag_name  | photo_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| #happy    |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| #happy    |        3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| #TGIF     |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| #TBT      |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| #TBT      |        3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Unlimited # of tags, but this is slower than first solution because it has duplicated strings over and over.&lt;/p&gt;&lt;h3 id=&quot;3-using-3-tables-preferred&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-using-3-tables-preferred&quot; aria-label=&quot;3 using 3 tables preferred permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Using 3 tables (preferred)&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;photos:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | url      | caption      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | /dociv32 | Madison      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | /39dksje | My dog       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | /kfeiw2  | selfie today |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;tags:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | tag_name  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | #happy    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | #handsome |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | #TGIF     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | #TBT      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | #Daily    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  6 | #FTW      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;photo_tags:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| photo_id | tag_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        1 |      2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        1 |      1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        3 |      2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        2 |      3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        2 |      6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        3 |      1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        3 |      4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        3 |      5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Unlimited # of tags and can add additional information&lt;/p&gt;&lt;p&gt;However, this requires more work when inserting/updating and have to worry about orphans; when deleting photos also need to remove all associated information&lt;/p&gt;&lt;p&gt;Read more about &lt;a href=&quot;http://howto.philippkeller.com/2005/06/19/Tagsystems-performance-tests/&quot; target=&quot;_blank&quot;&gt; schema performance test &lt;/a&gt;&lt;br/&gt;&lt;/p&gt;&lt;h2 id=&quot;work-with-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#work-with-data&quot; aria-label=&quot;work with data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Work with data&lt;/h2&gt;&lt;p&gt;Insert data from &lt;a href=&quot;&quot; target=&quot;_blank&quot;&gt; file.sql&lt;/a&gt; (currently not available)&lt;br/&gt;&lt;/p&gt;&lt;h3 id=&quot;find-the-5-oldest-users&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#find-the-5-oldest-users&quot; aria-label=&quot;find the 5 oldest users permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Find the 5 oldest users&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; created_at&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| username         | created_at          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Darby_Herzog     | 2016-05-06 00:14:21 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Emilio_Bernier52 | 2016-05-06 13:04:30 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Elenor88         | 2016-05-08 01:30:41 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nicole71         | 2016-05-09 17:30:22 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jordyn.Jacobson2 | 2016-05-14 07:56:26 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;what-day-do-most-users-sign-up-on&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-day-do-most-users-sign-up-on&quot; aria-label=&quot;what day do most users sign up on permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What day do most users sign up on&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Get day name from created_at&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; created_at&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    DAYNAME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;day&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Get DAYNAME &amp;amp; COUNT with GROUP BY&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DAYNAME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;day&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;DAYNAME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; cnt&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;day&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+-----+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| day       | cnt |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+-----+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Friday    |  15 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Monday    |  14 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Saturday  |  12 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sunday    |  16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Thursday  |  16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tuesday   |  14 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Wednesday |  13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+-----+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;3&quot;&gt;&lt;li&gt;LIMIT 1 (or 2)&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DAYNAME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;day&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;day&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;DAYNAME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;created_at&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| day      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Thursday |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;find-users-whos-never-posted&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#find-users-whos-never-posted&quot; aria-label=&quot;find users whos never posted permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Find users who&amp;#x27;s never posted&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;users Left Join photos&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; image_url&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Condition statement where image_url = NULL&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; image_url&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;IS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| username            | image_url |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Aniya_Hackett       | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bartholome.Bernhard | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bethany20           | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Darby_Herzog        | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David.Osinski47     | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Duane60             | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Esmeralda.Mraz57    | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Esther.Zulauf61     | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Franco_Keebler64    | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Hulda.Macejkovic    | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jaclyn81            | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Janelle.Nikolaus81  | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jessyca_West        | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Julien_Schmidt      | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Kasandra_Homenick   | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Leslie67            | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linnea59            | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Maxwell.Halvorson   | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mckenna17           | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mike.Auer39         | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Morgan.Kassulke     | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nia_Haag            | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ollie_Ledner37      | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pearl7              | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Rocio33             | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tierra.Trantow      | NULL      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;find-who-got-the-most-likes-on-a-photo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#find-who-got-the-most-likes-on-a-photo&quot; aria-label=&quot;find who got the most likes on a photo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Find who got the most likes on a photo&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Get # likes for each photo&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;ORDER BY &amp;amp; LIMIT&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| photo_id | likes |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|      145 |    48 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;3&quot;&gt;&lt;li&gt;Get username who posted photo_id=145&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------+----------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| username      | photo_id | likes |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------+----------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Zack_Kemmer93 |      145 |    48 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------+----------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;how-many-times-does-average-user-post&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#how-many-times-does-average-user-post&quot; aria-label=&quot;how many times does average user post permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;How many times does average user post&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Total # photos, Total # user&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| COUNT(id) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       257 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| COUNT(users.id) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|             100 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Divide&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| res    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 2.5700 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use sub-query without JOIN&lt;/p&gt;&lt;h3 id=&quot;get-5-most-commonly-used-hash-tags&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#get-5-most-commonly-used-hash-tags&quot; aria-label=&quot;get 5 most commonly used hash tags permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Get 5 most commonly used hash tags&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Get number of tags&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_tags&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;tag_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_tags&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_tags&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_tags&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;tag_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_tags &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| num_tags |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       59 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       42 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       39 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       38 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       24 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Join to get name of tag&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tag_name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_tags&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;tag_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_tags&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_tags&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tags &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tags&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_tags&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;tag_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photo_tags&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;tag_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_tags &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| tag_name | num_tags |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| smile    |       59 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| beach    |       42 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| party    |       39 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fun      |       38 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| concert  |       24 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;get-users-who-have-liked-every-single-photo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#get-users-who-have-liked-every-single-photo&quot; aria-label=&quot;get users who have liked every single photo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Get users who have liked every single photo&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Take a look at the likes table&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ DESC likes;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+-----------+------+-----+-------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Field      | Type      | Null | Key | Default           | Extra |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+-----------+------+-----+-------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| user_id    | int(11)   | NO   | PRI | NULL              |       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| photo_id   | int(11)   | NO   | PRI | NULL              |       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| created_at | timestamp | NO   |     | CURRENT_TIMESTAMP |       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+-----------+------+-----+-------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Get number of likes for each user&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_likes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;3&quot;&gt;&lt;li&gt;Get #photos&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_photos &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| num_photos |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        257 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;4&quot;&gt;&lt;li&gt;Select users with HAVING #likes = #photos&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_likes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;HAVING&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_likes &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photos&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; photos&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;5&quot;&gt;&lt;li&gt;Solution w/o using sub-query&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_likes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;user_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; users&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;HAVING&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; num_likes &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;MAX&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;likes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;photo_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Joins (Many to Many)]]></title><description><![CDATA[Work with 3 tables for many to many relationship]]></description><link>https://ellismin.com/2019/09/sql-join-2/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-join-2/</guid><pubDate>Mon, 30 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;many-to-many-relationship&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#many-to-many-relationship&quot; aria-label=&quot;many to many relationship permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Many to Many Relationship&lt;/h2&gt;&lt;p&gt;Many to Many relationship happens when a multiple records in a table are associated with a multiple records in another table.&lt;/p&gt;&lt;p&gt;Examples: students &amp;lt;-&amp;gt; classes, books &amp;lt;-&amp;gt; authors, blog posts &amp;lt;-&amp;gt; tags&lt;/p&gt;&lt;p&gt;We need an extra table(join table) that contains foreign key from both tables. For example, enrollments table below:&lt;/p&gt;&lt;p&gt;students &amp;lt;-&amp;gt; enrollments &amp;lt;-&amp;gt; classes&lt;/p&gt;&lt;ul&gt;&lt;li&gt;students(id, fname, lname)&lt;/li&gt;&lt;li&gt;enrollments(id, enrollment_dt, student_id, class_id)&lt;/li&gt;&lt;li&gt;classes(id, title, description, class_num)&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    title &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    description &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    class_num &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- need to be created at last&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    enrollment_date &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    student_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    class_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;prepare-data-insert&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#prepare-data-insert&quot; aria-label=&quot;prepare data insert permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Prepare Data (INSERT)&lt;/h2&gt;&lt;p&gt;Access SQL/txt file to create table and insert data&lt;br/&gt;&lt;/p&gt;&lt;a href=&quot;/sql/enrollments.sql&quot; target=&quot;_blank&quot;&gt;enrollments.sql&lt;/a&gt;&lt;br/&gt;&lt;a href=&quot;/sql/enrollments.txt&quot; target=&quot;_blank&quot;&gt;enrollments.txt&lt;/a&gt;&lt;br/&gt;Random data for **_enrollments_** was created with &lt;a href=&quot;/sql/SqlGenerator.java&quot; target=&quot;_blank&quot;&gt;SqlGenerator.java&lt;/a&gt;&lt;p&gt;Inserted data&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;students:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+--------+---------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname  | lname   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+--------+---------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Henry  | Lee     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Ann    | Ortiz   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Andre  | Gross   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Tracy  | Ortiz   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Victor | Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  6 | Martha | Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  7 | Pat    | Bush    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+--------+---------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;classes:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+--------------------------------+----------------------------------------------------------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | title                          | description                                                    | class_num |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+--------------------------------+----------------------------------------------------------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Botany                         | Learn about plants                                             |       101 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Intro to Computer Science      | Find out how to code                                           |       302 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Biology                        | We teach you the study of life                                 |       105 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Accounting                     | How to document financial transactions                         |       307 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Intro to Music                 | Learn about variety types of music                             |       113 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  6 | Pharmacology                   | Study of drug                                                  |       553 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  7 | Nursing                        | This course provides provision of professional nursing care    |       321 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  8 | European Literature            | Read modern wirtten works from Europe                          |       223 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  9 | Drawing                        | Course in basic drawing skills                                 |       206 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 10 | Photography                    | Fundamentals in technique with emphasis on individual projects |       601 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 11 | Languages and Cultures of Asia | Comparative perspective on Asian languages                     |       333 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 12 | Critical Reading and Writng    | Introduction to literary analysis                              |       401 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 13 | Intro to Buddihism             | General survey of Buddihist worldview and lifestyle            |       109 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 14 | Western Civilization           | Foundation of Western civilization                             |         3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+--------------------------------+----------------------------------------------------------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;enrollments:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-----------------+------------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | 2017-09-26      |          3 |       14 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | 2016-09-02      |          6 |        4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | 2015-02-07      |          3 |        7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | 2016-05-08      |          7 |        3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | 2013-12-28      |          6 |       11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  6 | 2018-10-16      |          1 |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  7 | 2015-02-21      |          6 |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  8 | 2014-07-19      |          4 |        3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  9 | 2016-11-27      |          7 |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 10 | 2017-09-09      |          6 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 11 | 2016-04-27      |          3 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 12 | 2015-10-05      |          7 |       12 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 13 | 2017-02-27      |          6 |        8 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 14 | 2012-06-19      |          4 |        7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 15 | 2014-09-05      |          4 |        4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 16 | 2017-12-18      |          2 |       13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 17 | 2013-08-13      |          2 |        3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 18 | 2019-01-28      |          4 |       14 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 19 | 2015-08-08      |          5 |        5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 20 | 2012-01-14      |          6 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 21 | 2016-05-12      |          2 |        9 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 22 | 2017-03-27      |          1 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 23 | 2013-12-17      |          4 |       13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 24 | 2016-10-06      |          1 |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 25 | 2016-12-05      |          3 |       14 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 26 | 2014-09-17      |          2 |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 27 | 2013-10-16      |          5 |       12 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 28 | 2018-12-23      |          5 |        8 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 29 | 2015-02-14      |          1 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 30 | 2012-06-14      |          1 |       13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 31 | 2016-11-22      |          4 |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 32 | 2013-02-14      |          5 |       11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 33 | 2012-06-22      |          2 |        4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 34 | 2019-01-20      |          6 |       12 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 35 | 2019-07-09      |          4 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 36 | 2016-04-25      |          1 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 37 | 2018-02-10      |          4 |        6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 38 | 2018-09-13      |          5 |        4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 39 | 2012-08-26      |          3 |       11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 40 | 2015-10-26      |          6 |        5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 41 | 2012-04-16      |          4 |       12 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 42 | 2018-01-12      |          5 |       11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 43 | 2012-05-05      |          5 |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-----------------+------------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In enrollments table, there is class with class_id=10 that doesn&amp;#x27;t assign any student (Photography).&lt;/p&gt;&lt;h2 id=&quot;join-classes-with-enrollments&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#join-classes-with-enrollments&quot; aria-label=&quot;join classes with enrollments permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Join classes with enrollments&lt;/h2&gt;&lt;h3 id=&quot;inner-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inner-join&quot; aria-label=&quot;inner join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;INNER JOIN&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollment_date &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         | 2016-11-27      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         | 2012-05-05      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | 2018-10-16      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | 2015-02-21      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | 2016-10-06      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | 2014-09-17      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | 2016-11-22      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        | 2016-05-08      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        | 2014-07-19      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        | 2013-08-13      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | 2016-09-02      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | 2014-09-05      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | 2012-06-22      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | 2018-09-13      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 | 2015-08-08      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 | 2015-10-26      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2017-09-09      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2016-04-27      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2012-01-14      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2017-03-27      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2015-02-14      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2019-07-09      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2016-04-25      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | 2018-02-10      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        | 2015-02-07      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        | 2012-06-19      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            | 2017-02-27      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            | 2018-12-23      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Drawing                        | 2016-05-12      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | 2013-12-28      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | 2013-02-14      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | 2012-08-26      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | 2018-01-12      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | 2015-10-05      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | 2013-10-16      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | 2019-01-20      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | 2012-04-16      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              | 2017-12-18      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              | 2013-12-17      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              | 2012-06-14      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           | 2017-09-26      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           | 2019-01-28      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           | 2016-12-05      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Displays all classes with enrollment_date&lt;/p&gt;&lt;h3 id=&quot;group-by--inner-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#group-by--inner-join&quot; aria-label=&quot;group by  inner join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;GROUP BY &amp;amp; Inner Join&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;enrollment_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students_assigned &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students_assigned&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| title                          | students_assigned |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Drawing                        |                 1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              |                 3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           |                 3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        |                 3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   |                 4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     |                 4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia |                 4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      |                 5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |                 8 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;13 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows classes with # students assigned in class&lt;/p&gt;&lt;h3 id=&quot;group-by--left-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#group-by--left-join&quot; aria-label=&quot;group by  left join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;GROUP BY &amp;amp; Left Join&lt;/h3&gt;&lt;p&gt;Use &lt;strong&gt;Left Join&lt;/strong&gt; to &lt;strong&gt;include class that doesn&amp;#x27;t have any student&lt;/strong&gt; assigned.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;enrollment_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students_assigned &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students_assigned&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| title                          | students_assigned |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Photography                    |                 0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Drawing                        |                 1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 |                 2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           |                 3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              |                 3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        |                 3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia |                 4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     |                 4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   |                 4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      |                 5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |                 8 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;We now have &lt;strong&gt;Photography&lt;/strong&gt; class that doesn&amp;#x27;t have any student.&lt;/li&gt;&lt;li&gt;Try not to use &lt;strong&gt;GROUP BY title&lt;/strong&gt;. Using &lt;strong&gt;GROUP BY classes.id&lt;/strong&gt; is a &lt;strong&gt;better practice&lt;/strong&gt;.&lt;/li&gt;&lt;li&gt;For &lt;strong&gt;&lt;em&gt;Photography&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;COUNT(enrollment_date)&lt;/em&gt;&lt;/strong&gt; returns &lt;strong&gt;0&lt;/strong&gt; not &lt;strong&gt;NULL&lt;/strong&gt;&lt;ul&gt;&lt;li&gt;In contrast, MIN, MAX, AVG will return &lt;strong&gt;NULL&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;where--having&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#where--having&quot; aria-label=&quot;where  having permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;WHERE &amp;amp; HAVING&lt;/h2&gt;&lt;p&gt;Show class(es) without any student assigned&lt;/p&gt;&lt;h3 id=&quot;with-where-clause&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#with-where-clause&quot; aria-label=&quot;with where clause permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;With WHERE clause&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollment_date&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollment_date &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;IS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;having&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#having&quot; aria-label=&quot;having permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;HAVING&lt;/h3&gt;&lt;p&gt;Show class(es) that has 2 students&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;enrollment_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;HAVING&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;enrollment_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| title       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Photography |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An aggregate may not appear in the &lt;strong&gt;WHERE&lt;/strong&gt; unless it is in a sub-query contained in &lt;strong&gt;HAVING&lt;/strong&gt;. &lt;strong&gt;HAVING&lt;/strong&gt; is useful in combination with &lt;strong&gt;GROUP BY&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;LEFT JOIN is needed because we need all information from &lt;strong&gt;&lt;em&gt;classes&lt;/em&gt;&lt;/strong&gt; table which doesn&amp;#x27;t have a matching information with &lt;strong&gt;enrollments&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;join-students-with-enrollment&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#join-students-with-enrollment&quot; aria-label=&quot;join students with enrollment permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Join students with enrollment&lt;/h2&gt;&lt;h3 id=&quot;inner-join-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inner-join-1&quot; aria-label=&quot;inner join 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;INNER JOIN&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;enrollment_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;numClasses&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | lname   | numClasses |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Henry  | Lee     |          6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ann    | Ortiz   |          5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Andre  | Gross   |          5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tracy  | Ortiz   |          9 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Victor | Blair   |          7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Martha | Stevens |          8 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pat    | Bush    |          3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------+------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Same result for &lt;strong&gt;LEFT JOIN&lt;/strong&gt; and &lt;strong&gt;RIGHT JOIN&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;join-all-3-tables&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#join-all-3-tables&quot; aria-label=&quot;join all 3 tables permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;JOIN ALL 3 tables&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; class_num&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; student&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-----------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| title                          | class_num | student        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-----------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     |       307 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     |       307 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     |       307 | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     |       307 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        |       105 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        |       105 | Pat Bush       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        |       105 | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         |       101 | Pat Bush       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         |       101 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   |       401 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   |       401 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   |       401 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   |       401 | Pat Bush       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Drawing                        |       206 | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            |       223 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            |       223 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              |       109 | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              |       109 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              |       109 | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      |       302 | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      |       302 | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      |       302 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      |       302 | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      |       302 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 |       113 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 |       113 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia |       333 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia |       333 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia |       333 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia |       333 | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        |       321 | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        |       321 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   |       553 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           |         3 | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           |         3 | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           |         3 | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+-----------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;43 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Display classes along with students.&lt;/p&gt;&lt;h3 id=&quot;remove-duplicates&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#remove-duplicates&quot; aria-label=&quot;remove duplicates permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Remove duplicates&lt;/h3&gt;&lt;p&gt;Note there&amp;#x27;s a &lt;strong&gt;data error&lt;/strong&gt; where one student is enrolled in class a multiple times. To remove duplicate students, GROUP BY title and students.id together.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; student&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| title                          | student        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting                     | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology                        | Pat Bush       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Botany                         | Pat Bush       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Critical Reading and Writing   | Pat Bush       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Drawing                        | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| European Literature            | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Buddhism              | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | Ann Ortiz      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Music                 | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | Victor Blair   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Nursing                        | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | Henry Lee      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | Martha Stevens |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           | Andre Gross    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           | Tracy Ortiz    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;36 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;show-error-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#show-error-data&quot; aria-label=&quot;show error data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Show error data&lt;/h3&gt;&lt;p&gt;Show the error data. i.e. student in class a multiple times&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; student&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; duplicate_cnt&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;HAVING&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+----------------+---------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| title                          | student        | duplicate_cnt |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+----------------+---------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Intro to Computer Science      | Henry Lee      |             2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Languages and Cultures of Asia | Victor Blair   |             2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | Henry Lee      |             3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | Tracy Ortiz    |             2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pharmacology                   | Martha Stevens |             2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Western Civilization           | Andre Gross    |             2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+----------------+---------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Henry Lee shows up in Intro to Computer Science twice, VIctor Blair in Languages and Cultures of Asia and so on.&lt;/p&gt;&lt;h2 id=&quot;unique-keyid-id2&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#unique-keyid-id2&quot; aria-label=&quot;unique keyid id2 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;UNIQUE KEY(id, id2)&lt;/h2&gt;&lt;p&gt;Setting tuple of student_id and class_id as &lt;strong&gt;UNIQUE&lt;/strong&gt; (or &lt;strong&gt;PRIMARY&lt;/strong&gt;) &lt;strong&gt;KEY&lt;/strong&gt; can prevent above &lt;strong&gt;data error&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    title &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    description &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    class_num &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- need to be created at last&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; enrollments2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    enrollment_date &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    student_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    class_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;class_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;UNIQUE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; class_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;hey&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;man&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; classes2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; description&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; class_num&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Botany&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;study of plants&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;207&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;enrollments2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;enrollment_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; class_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CURDATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- Triggers error&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;enrollments2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;enrollment_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; class_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CURDATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ERROR 1062 (23000): Duplicate entry &amp;#x27;1-1&amp;#x27; for key &amp;#x27;PRIMARY&amp;#x27;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;UNIQUE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;students_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; class_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This line of code prevents classes from having duplicate student or students to have a duplicate courses. You can also use &lt;strong&gt;PRIMARY KEY&lt;/strong&gt;, but in a table only one primary key is allowed.&lt;/p&gt;&lt;h3 id=&quot;unique-vs-primary-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#unique-vs-primary-key&quot; aria-label=&quot;unique vs primary key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;UNIQUE VS PRIMARY KEY&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Primary Key&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;There can be only one primary key in a table&lt;/li&gt;&lt;li&gt;Some DBMS doesn&amp;#x27;t allow NULL&lt;/li&gt;&lt;li&gt;Primary key is a unique identifier&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Unique Key&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;There can be more than one unique key&lt;/li&gt;&lt;li&gt;Unique can have NULL values&lt;/li&gt;&lt;li&gt;It can be candidate key&lt;/li&gt;&lt;li&gt;Unique key can be NULL. i.e. multiple rows can have NULL values thus not necessarily &amp;quot;unique&amp;quot;&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Joins (One to Many)]]></title><description><![CDATA[FOREIGN KEY • Sub-query • Cross Join • Inner Join • Left/Right Join]]></description><link>https://ellismin.com/2019/09/sql-join-1/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-join-1/</guid><pubDate>Sun, 29 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;Join is useful when working with multiple tables.&lt;/p&gt;&lt;p&gt;Real world data is complicated and interrelated.&lt;/p&gt;&lt;h2 id=&quot;relationship-basics&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#relationship-basics&quot; aria-label=&quot;relationship basics permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Relationship Basics&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;One to One Relationship&lt;/li&gt;&lt;li&gt;One to Many Relationship -- common.&lt;br/&gt;
Example: students &amp;lt;--&amp;gt; notes. Students have many notes on different classes but those notes belong to one student&lt;/li&gt;&lt;li&gt;Many to Many Relationship -- also common.&lt;br/&gt;
Example: students &amp;lt;--&amp;gt; classes. Students take many classes, and within those classes there are many students.&lt;/li&gt;&lt;/ol&gt;&lt;h3 id=&quot;one-to-many-relationship-1many&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#one-to-many-relationship-1many&quot; aria-label=&quot;one to many relationship 1many permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;One to Many Relationship (1:Many)&lt;/h3&gt;&lt;p&gt;Example: Customers &amp;amp; Orders. Customers can have many orders, but those orders belong to each customer&lt;/p&gt;&lt;h3 id=&quot;bad-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#bad-example&quot; aria-label=&quot;bad example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Bad Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customersAndOrders &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    customer_fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    customer_lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    email &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    purchase_date &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    price &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DECIMAL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+----------------+-------------------+---------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| customer_fname | customer_lname | email             | purchase_date | price  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+----------------+-------------------+---------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith          | Kent           | sk@gmail.com      | 2018-03-16    | 106.11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith          | Kent           | sk@gmail.com      | 2019-01-11    |  32.76 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam            | Park           | park123@gmail.com | 2014-07-14    | 423.03 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam            | Park           | park123@gmail.com | 2015-02-16    |  13.16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan            | Lee            | dandan@gmail.com  | NULL          |   NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Grey           | George         | coco@gmail.com    | NULL          |   NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+----------------+-------------------+---------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This does work, but it&amp;#x27;s a bad design--it has a multiple &lt;strong&gt;duplicate information&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;foreign-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#foreign-key&quot; aria-label=&quot;foreign key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;FOREIGN KEY&lt;/h2&gt;&lt;p&gt;Let&amp;#x27;s keep our &lt;strong&gt;data separate&lt;/strong&gt; using &lt;strong&gt;&lt;em&gt;FOREIGN KEY&lt;/em&gt;&lt;/strong&gt;&lt;br/&gt;
SQL file to create and insert into &lt;strong&gt;&lt;em&gt;customers&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;orders&lt;/em&gt;&lt;/strong&gt; tables is available from&lt;br/&gt;&lt;/p&gt;&lt;a href=&quot;/extra/customers_orders_tables.sql&quot; target=&quot;_blank&quot;&gt;customers.orders_tables.sql&lt;/a&gt;&lt;br/&gt;&lt;a href=&quot;/extra/customers_orders_tables.txt&quot; target=&quot;_blank&quot;&gt;customers.orders_tables.txt&lt;/a&gt;&lt;a href=&quot;https://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html#foreign-keys-adding&quot; target=&quot;_blank&quot;&gt; Documentation on FOREIGN KEY&lt;/a&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    email &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- MySQL version&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    order_date &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    price &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DECIMAL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    customer_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- FOREIGN KEY assignment in SQL Server / Oracle / MS Access (different RDMS)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;--customer_id INT FOREIGN KEY REFERENCES customers(id)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Field | Type        | Null | Key | Default | Extra          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id    | int(11)     | NO   | PRI | NULL    | auto_increment |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | varchar(30) | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| lname | varchar(30) | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| email | varchar(60) | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+--------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Field       | Type         | Null | Key | Default | Extra          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+--------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id          | int(11)      | NO   | PRI | NULL    | auto_increment |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| order_date  | date         | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| price       | decimal(8,2) | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| customer_id | int(11)      | YES  | MUL | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+--------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that &lt;strong&gt;&lt;em&gt;orders&lt;/em&gt;&lt;/strong&gt; have a &lt;strong&gt;FOREIGN KEY&lt;/strong&gt; customer&lt;em&gt;id referencing **_id&lt;/em&gt;&lt;strong&gt; in &lt;/strong&gt;&lt;em&gt;customers&lt;/em&gt;**. FOREIN KEY is used to reference an external table.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;customer_id&lt;/em&gt;&lt;/strong&gt; is a naming convention to denote that it&amp;#x27;s referencing &lt;strong&gt;&lt;em&gt;id&lt;/em&gt;&lt;/strong&gt; in &lt;strong&gt;&lt;em&gt;customer&lt;/em&gt;&lt;/strong&gt; table&lt;/p&gt;&lt;p&gt;If the foreign key doesn&amp;#x27;t exist in customers, it will throw an error because there must be a customer that has the order&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;99&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; fails (`online`.`orders`, CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`customer_i&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;d`) REFERENCES `customers` (`id`))&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Smith&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Kent&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;sk@gmail.com&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2018-03-16&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;106.11&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname | email        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent  | sk@gmail.com |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can&amp;#x27;t drop the table that has data that is being referenced. You can remove orders table first then customers table or both at once.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DROP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- orders should come first otherwise customers table won&amp;#x27;t be removed&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;add-more-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#add-more-data&quot; aria-label=&quot;add more data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Add more data&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; email&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Sam&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Park&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;park123@gmail.com&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Dan&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Lee&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;dandan@gmail.com&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Grey&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;George&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;coco@gmail.com&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Joy&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Grey&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;greygray@gmail.com&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2019-01-11&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;32.76&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2014-07-14&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;423.03&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2015-02-16&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;13.16&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2019-05-27&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;207.88&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname  | email              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;adding-foreign-key&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#adding-foreign-key&quot; aria-label=&quot;adding foreign key permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding FOREIGN KEY&lt;/h3&gt;&lt;p&gt;If you want to add a foreign key, you can add with the following:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ALTER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ADD&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- Adding  FOREIGN KEY with specified constraint&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ALTER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ADD&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CONSTRAINT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; FK_CustomerOrder&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;drop-a-foreign-key-constraint&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#drop-a-foreign-key-constraint&quot; aria-label=&quot;drop a foreign key constraint permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DROP a FOREIGN KEY Constraint&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ALTER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DROP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; FK_CustomerOrder&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you didn&amp;#x27;t specify the CONSTRAINT when creating a FOREIGN KEY, MySQL generates automatically internally. To access auto-generated name of CONSTRAINT, use the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SHOW&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Table  | Create Table |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| orders | CREATE TABLE `orders` (&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  `id` int(11) NOT NULL AUTO_INCREMENT,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  `order_date` date DEFAULT NULL,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  `price` decimal(8,2) DEFAULT NULL,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  `customer_id` int(11) DEFAULT NULL,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  PRIMARY KEY (`id`),&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  KEY `customer_id` (`customer_id`),&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 |&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now you can remove foreign constraint key with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;ALTER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;drop&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders_ibfk_1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;on-delete-cascade&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#on-delete-cascade&quot; aria-label=&quot;on delete cascade permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ON DELETE CASCADE&lt;/h3&gt;&lt;p&gt;When customers2 is deleted which has a corresponding data in orders2, delete orders2 as well&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    customer_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CASCADE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers2 &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders2 &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers2 &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ SELECT * FROM orders2;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Empty set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Deletion on customers2 also removed data in orders2&lt;/p&gt;&lt;h2 id=&quot;combining-two-tables&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#combining-two-tables&quot; aria-label=&quot;combining two tables permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Combining two tables&lt;/h2&gt;&lt;p&gt;What if you want information combined together from both tables?&lt;br/&gt;
For example,&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Park&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customer_id&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;using-sub-query&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#using-sub-query&quot; aria-label=&quot;using sub query permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using Sub-query&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customer_id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Park&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The sub-query..&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Park&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;is equal to &lt;strong&gt;&lt;em&gt;2&lt;/em&gt;&lt;/strong&gt; in this case. It yields the same results as previous query. Also note that the query just has &lt;strong&gt;one semi-colon&lt;/strong&gt; at the end.&lt;/p&gt;&lt;p&gt;This isn&amp;#x27;t very ideal nor useful.&lt;/p&gt;&lt;h2 id=&quot;cross-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#cross-join&quot; aria-label=&quot;cross join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Cross Join&lt;/h2&gt;&lt;p&gt;Use JOIN to conjoin two tables--stick them together. This however results in a &lt;strong&gt;messy&lt;/strong&gt; table.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname  | email              | id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can see a &lt;strong&gt;multiple duplicate&lt;/strong&gt; information--takes every customer and conjoins every order like a multiplication. Yet, we can start to boil it down.&lt;/p&gt;&lt;h2 id=&quot;inner-join-implicit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inner-join-implicit&quot; aria-label=&quot;inner join implicit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Inner Join (Implicit)&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Inner Join&lt;/strong&gt; selects records from table A and B where the &lt;strong&gt;join condition is met&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname | email              | id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent  | sk@gmail.com       |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent  | sk@gmail.com       |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park  | park123@gmail.com  |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park  | park123@gmail.com  |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey  | greygray@gmail.com |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;customers.id&lt;/em&gt;&lt;/strong&gt; is in format of &lt;strong&gt;&lt;em&gt;$tableName.$col&lt;/em&gt;&lt;/strong&gt; to avoid ambiguity. i.e. Both orders and students have &lt;strong&gt;&lt;em&gt;id&lt;/em&gt;&lt;/strong&gt; columns.&lt;/p&gt;&lt;p&gt;You don&amp;#x27;t necessarily have to put the table name like &lt;strong&gt;&lt;em&gt;orders.customer_id&lt;/em&gt;&lt;/strong&gt; since &lt;strong&gt;&lt;em&gt;customer_id&lt;/em&gt;&lt;/strong&gt; only exists in &lt;strong&gt;&lt;em&gt;orders&lt;/em&gt;&lt;/strong&gt; table, but this is a &lt;strong&gt;convention&lt;/strong&gt; to follow&lt;/p&gt;&lt;h3 id=&quot;selecting-certain-columns&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#selecting-certain-columns&quot; aria-label=&quot;selecting certain columns permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Selecting certain columns&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname | order_date | price  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent  | 2018-03-16 | 106.11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent  | 2019-01-11 |  32.76 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park  | 2014-07-14 | 423.03 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park  | 2015-02-16 |  13.16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey  | 2019-05-27 | 207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;inner-join-explicit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inner-join-explicit&quot; aria-label=&quot;inner join explicit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Inner Join (Explicit)&lt;/h2&gt;&lt;p&gt;More &lt;strong&gt;conventional&lt;/strong&gt; way of joining--more cleaner and easily understood. &lt;strong&gt;Preferred way&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname | order_date | price  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent  | 2018-03-16 | 106.11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent  | 2019-01-11 |  32.76 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park  | 2014-07-14 | 423.03 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park  | 2015-02-16 |  13.16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey  | 2019-05-27 | 207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Creating the union table where &lt;strong&gt;&lt;em&gt;customers.id = orders.customer_id&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Yields the same result as above implicit inner join.&lt;/p&gt;&lt;p&gt;It&amp;#x27;s optional to explicitly write&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INNER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;different-order&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#different-order&quot; aria-label=&quot;different order permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Different order&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | order_date | price  | customer_id | id | fname | lname  | email              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | 2018-03-16 | 106.11 |           1 |  1 | Smith | Kent   | sk@gmail.com       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | 2019-01-11 |  32.76 |           1 |  2 | Sam   | Park   | park123@gmail.com  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | 2014-07-14 | 423.03 |           2 |  3 | Dan   | Lee    | dandan@gmail.com   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | 2015-02-16 |  13.16 |           2 |  4 | Grey  | George | coco@gmail.com     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | 2019-05-27 | 207.88 |           5 |  5 | Joy   | Grey   | greygray@gmail.com |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+--------+-------------+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows the data in different order of columns unless you specify columns after SELECT&lt;/p&gt;&lt;h3 id=&quot;more-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-example&quot; aria-label=&quot;more example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname | order_date | price  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park  | 2014-07-14 | 423.03 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park  | 2015-02-16 |  13.16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent  | 2018-03-16 | 106.11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent  | 2019-01-11 |  32.76 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey  | 2019-05-27 | 207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Display ordered by order date&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; total_spent&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; total_spent &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname | total_spent |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park  |      436.19 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey  |      207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent  |      138.87 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows total amount spent on order(s) in descending order&lt;/p&gt;&lt;h3 id=&quot;arbitrary-join----avoid-doing-it&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#arbitrary-join----avoid-doing-it&quot; aria-label=&quot;arbitrary join    avoid doing it permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Arbitrary Join -- Avoid doing it&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname  | email              | id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Joining on arbitrary conditions is allowed, but this is &lt;strong&gt;meaningless&lt;/strong&gt;.&lt;/p&gt;&lt;h2 id=&quot;left-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#left-join&quot; aria-label=&quot;left join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;LEFT Join&lt;/h2&gt;&lt;p&gt;Selects &lt;strong&gt;all data from A&lt;/strong&gt; along with many &lt;strong&gt;matching data in B&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname  | email              | id   | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |    1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |    2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |    3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |    4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |    5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   | NULL | NULL       |   NULL |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     | NULL | NULL       |   NULL |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Information of &lt;strong&gt;&lt;em&gt;customers&lt;/em&gt;&lt;/strong&gt; is displayed on left and &lt;strong&gt;&lt;em&gt;orders&lt;/em&gt;&lt;/strong&gt; on right. The information that does not match is marked as &lt;strong&gt;NULL&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname  | order_date | price  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent   | 2018-03-16 | 106.11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent   | 2019-01-11 |  32.76 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park   | 2014-07-14 | 423.03 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park   | 2015-02-16 |  13.16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey   | 2019-05-27 | 207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan   | Lee    | NULL       |   NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Grey  | George | NULL       |   NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;LEFT Join can be useful in this case; for example if you want to tabulate information including who did not place any order.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; total_spent&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; total_spent &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname  | total_spent |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park   |      436.19 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey   |      207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent   |      138.87 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan   | Lee    |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Grey  | George |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;ifnull&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#ifnull&quot; aria-label=&quot;ifnull permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;IFNULL&lt;/h3&gt;&lt;p&gt;You can add conditional statement for &lt;strong&gt;NULL&lt;/strong&gt; values&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;IFNULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; total_spent&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; total_spent &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname  | total_spent |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park   |      436.19 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey   |      207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent   |      138.87 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan   | Lee    |        0.00 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Grey  | George |        0.00 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;inner-vs-left-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inner-vs-left-join&quot; aria-label=&quot;inner vs left join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;INNER vs LEFT Join&lt;/h3&gt;&lt;p&gt;Both join data from two tables, but..&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Inner Join selects &lt;strong&gt;all data from A and B&lt;/strong&gt; where the &lt;strong&gt;join condition is met&lt;/strong&gt; (exact overlap)&lt;/li&gt;&lt;li&gt;Left Join selects &lt;strong&gt;all data from A along with matching records in B&lt;/strong&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h2 id=&quot;right-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#right-join&quot; aria-label=&quot;right join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Right Join&lt;/h2&gt;&lt;p&gt;Similar to &lt;strong&gt;Left Join&lt;/strong&gt;, &lt;strong&gt;Right Join&lt;/strong&gt; selects &lt;strong&gt;all data from B along with matching record in A&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;inner-vs-left-vs-right-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#inner-vs-left-vs-right-join&quot; aria-label=&quot;inner vs left vs right join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;INNER vs LEFT vs RIGHT Join&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INNER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;RIGHT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname | email              | id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent  | sk@gmail.com       |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent  | sk@gmail.com       |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park  | park123@gmail.com  |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park  | park123@gmail.com  |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey  | greygray@gmail.com |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname  | email              | id   | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |    1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |    2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |    3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |    4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |    5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   | NULL | NULL       |   NULL |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     | NULL | NULL       |   NULL |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id   | fname | lname | email              | id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    1 | Smith | Kent  | sk@gmail.com       |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    1 | Smith | Kent  | sk@gmail.com       |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    2 | Sam   | Park  | park123@gmail.com  |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    2 | Sam   | Park  | park123@gmail.com  |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    5 | Joy   | Grey  | greygray@gmail.com |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Results of Inner Join and Right Join are the same because &lt;strong&gt;there is no order that does not match with customers&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;left-vs-right-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#left-vs-right-join&quot; aria-label=&quot;left vs right join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Left vs Right Join&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;RIGHT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname  | email              | id   | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |    1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent   | sk@gmail.com       |    2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |    3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park   | park123@gmail.com  |    4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey   | greygray@gmail.com |    5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | Dan   | Lee    | dandan@gmail.com   | NULL | NULL       |   NULL |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | Grey  | George | coco@gmail.com     | NULL | NULL       |   NULL |        NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+--------+--------------------+------+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+------------+--------+-------------+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id   | order_date | price  | customer_id | id | fname | lname  | email              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+------------+--------+-------------+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    1 | 2018-03-16 | 106.11 |           1 |  1 | Smith | Kent   | sk@gmail.com       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    2 | 2019-01-11 |  32.76 |           1 |  1 | Smith | Kent   | sk@gmail.com       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    3 | 2014-07-14 | 423.03 |           2 |  2 | Sam   | Park   | park123@gmail.com  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    4 | 2015-02-16 |  13.16 |           2 |  2 | Sam   | Park   | park123@gmail.com  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    5 | 2019-05-27 | 207.88 |           5 |  5 | Joy   | Grey   | greygray@gmail.com |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| NULL | NULL       |   NULL |        NULL |  3 | Dan   | Lee    | dandan@gmail.com   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| NULL | NULL       |   NULL |        NULL |  4 | Grey  | George | coco@gmail.com     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+------------+--------+-------------+----+-------+--------+--------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Left and Right Join achieve the exact same goal&lt;/strong&gt;. It shows in a different order, but it&amp;#x27;s trivial. If you specify the column orders, it will &lt;strong&gt;result in the same&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;Some RDMS don&amp;#x27;t even support RIGHT JOIN&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;RIGHT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname  | price  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent   | 106.11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith | Kent   |  32.76 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park   | 423.03 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Park   |  13.16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy   | Grey   | 207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan   | Lee    |   NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Grey  | George |   NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;tweak-the-data-to-distinguish-with-inner-join&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#tweak-the-data-to-distinguish-with-inner-join&quot; aria-label=&quot;tweak the data to distinguish with inner join permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Tweak the data to distinguish with Inner Join&lt;/h3&gt;&lt;p&gt;Let&amp;#x27;s modify data in left table, a.k.a. table A or &lt;strong&gt;&lt;em&gt;orders&lt;/em&gt;&lt;/strong&gt; table because then JOIN on customers will have NULL in it.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;-- DROP the FOREIGN KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ALTER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DROP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders_ibfk_1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- retrieved from SHOW CREATE TABLE orders;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- INSERT data into orders&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;order_date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2000-02-02&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;99&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CURDATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;276&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;45&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | order_date | price   | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | 2018-03-16 |  106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | 2019-01-11 |   32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  3 | 2014-07-14 |  423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  4 | 2015-02-16 |   13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | 2019-05-27 |  207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  8 | 2000-02-02 | 3000.00 |          99 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  9 | 2019-09-30 |  276.00 |          45 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+------------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id | fname | lname | email              | id | order_date | price  | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent  | sk@gmail.com       |  1 | 2018-03-16 | 106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  1 | Smith | Kent  | sk@gmail.com       |  2 | 2019-01-11 |  32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park  | park123@gmail.com  |  3 | 2014-07-14 | 423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  2 | Sam   | Park  | park123@gmail.com  |  4 | 2015-02-16 |  13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  5 | Joy   | Grey  | greygray@gmail.com |  5 | 2019-05-27 | 207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----+-------+-------+--------------------+----+------------+--------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There is &lt;strong&gt;no change&lt;/strong&gt; in &lt;strong&gt;Left Join&lt;/strong&gt; because the added rows in &lt;strong&gt;&lt;em&gt;orders&lt;/em&gt;&lt;/strong&gt; does not have matching data with &lt;strong&gt;&lt;em&gt;customers&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;RIGHT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+-------+-------+--------------------+----+------------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| id   | fname | lname | email              | id | order_date | price   | customer_id |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+-------+-------+--------------------+----+------------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    1 | Smith | Kent  | sk@gmail.com       |  1 | 2018-03-16 |  106.11 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    1 | Smith | Kent  | sk@gmail.com       |  2 | 2019-01-11 |   32.76 |           1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    2 | Sam   | Park  | park123@gmail.com  |  3 | 2014-07-14 |  423.03 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    2 | Sam   | Park  | park123@gmail.com  |  4 | 2015-02-16 |   13.16 |           2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    5 | Joy   | Grey  | greygray@gmail.com |  5 | 2019-05-27 |  207.88 |           5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| NULL | NULL  | NULL  | NULL               |  8 | 2000-02-02 | 3000.00 |          99 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| NULL | NULL  | NULL  | NULL               |  9 | 2019-09-30 |  276.00 |          45 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+-------+-------+--------------------+----+------------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, &lt;strong&gt;RIGHT JOIN&lt;/strong&gt; now has NULL values because there is no matching data for newly added date in customers&lt;/p&gt;&lt;h3 id=&quot;adding-conditions&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#adding-conditions&quot; aria-label=&quot;adding conditions permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Adding conditions&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; IFNULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;MISSING&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    IFNULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;MISSING&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; total_spent&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;RIGHT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; orders&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;customer_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; customer_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname   | lname   | total_spent |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith   | Kent    |      138.87 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam     | Park    |      436.19 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joy     | Grey    |      207.88 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| MISSING | MISSING |      276.00 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| MISSING | MISSING |     3000.00 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------+---------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;challenge&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#challenge&quot; aria-label=&quot;challenge permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Challenge&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt; is available at the end of page&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Create a table with the following information&lt;br/&gt;
students: id, first name&lt;br/&gt;
notes: title, content, student_id(FOREIGN KEY)&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;After creating the table, insert the following data:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;David&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Foster&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Jason&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Sam&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Ham&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;algebra note&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;This is cs566 note&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;555&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;I like calculus&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Literature course note from yesterday&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;notes on SQL&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;75&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Print this&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | title                                 | pages |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | This is cs566 note                    |   555 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam    | notes on SQL                          |    75 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | algebra note                          |    16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster | I like calculus                       |     7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster | Literature course note from yesterday |     2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;3&quot;&gt;&lt;li&gt;Print this&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | title                                 | pages |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | algebra note                          |    16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | This is cs566 note                    |   555 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster | I like calculus                       |     7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster | Literature course note from yesterday |     2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jason  | NULL                                  |  NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam    | notes on SQL                          |    75 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ham    | NULL                                  |  NULL |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;4&quot;&gt;&lt;li&gt;Print this&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | title                                 | pages |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | algebra note                          |    16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | This is cs566 note                    |   555 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster | I like calculus                       |     7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster | Literature course note from yesterday |     2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jason  | MISSING                               |     0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam    | notes on SQL                          |    75 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ham    | MISSING                               |     0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+---------------------------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;5&quot;&gt;&lt;li&gt;Print this&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | avg      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | 285.5000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam    |  75.0000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster |   4.5000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jason  |   0.0000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ham    |   0.0000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;6&quot;&gt;&lt;li&gt;Print this. Long notes if AVG(pages) &amp;gt; 70&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | avg      | notes_status |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| David  | 285.5000 | Long notes   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam    |  75.0000 | Long notes   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Foster |   4.5000 | Short notes  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jason  |   0.0000 | Short notes  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ham    |   0.0000 | Short notes  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+----------+--------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;h3 id=&quot;solution&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#solution&quot; aria-label=&quot;solution permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Solution&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Creating table&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AUTO_INCREMENT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    title &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    pages &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    student_id &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FOREIGN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REFERENCES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CASCADE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;INNER JOIN&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pages&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pages &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pages&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;RIGHT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pages &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;3&quot;&gt;&lt;li&gt;LEFT JOIN&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pages&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;4&quot;&gt;&lt;li&gt;IFNULL&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    IFNULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;MISSING&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    IFNULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;pages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; pages&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;5&quot;&gt;&lt;li&gt;GROUP BY&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;     IFNULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;pages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; avg&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; avg &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;6&quot;&gt;&lt;li&gt;CASE&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;     IFNULL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;pages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; avg&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CASE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;pages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;IS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Short notes&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- Not necessary but a good practice&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;pages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;70&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Long notes&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ELSE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Short notes&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;notes_status&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LEFT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;JOIN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; notes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;student_id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;id&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; avg &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that in CASE, you can&amp;#x27;t use refer to &amp;quot;avg&amp;quot;.&lt;/p&gt;&lt;p&gt;Use &lt;strong&gt;IS NULL&lt;/strong&gt; for condition with WHEN&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Logical Operators]]></title><description><![CDATA[Logical operators • CAST • CASE • WHEN • IF]]></description><link>https://ellismin.com/2019/09/sql-logical-ops/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-logical-ops/</guid><pubDate>Sat, 28 Sep 2019 00:00:02 GMT</pubDate><content:encoded>&lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html&quot; target=&quot;_blank&quot;&gt;Documentation on Comparison functions and operators&lt;/a&gt;&lt;br/&gt;&lt;p&gt;Students data available from&lt;/p&gt;&lt;a href=&quot;/sql/students.sql&quot; target=&quot;_black&quot;&gt;students.sql&lt;/a&gt;&lt;br/&gt;&lt;a href=&quot;/sql/students.txt&quot; target=&quot;_black&quot;&gt;students.txt&lt;/a&gt;&lt;br/&gt;&lt;h2 id=&quot;not-equal&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#not-equal&quot; aria-label=&quot;not equal permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;NOT Equal&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Computer Science&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| major        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linguistics  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemistry    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Business     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biochemistry |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physics      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| no_major     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Japanese 10% |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Food Science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Economics    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows all majors except for &lt;strong&gt;&lt;em&gt;Computer Science&lt;/em&gt;&lt;/strong&gt;. Case Sensitive.&lt;/p&gt;&lt;h2 id=&quot;not-like&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#not-like&quot; aria-label=&quot;not like permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;NOT LIKE&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2%&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | age  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis  |   18 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John   |   19 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont |   18 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego  |   17 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary   |   16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena   |   31 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis  |   18 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Show ages that are not twenties. Better practice may be using range (upcoming)&lt;/p&gt;&lt;h2 id=&quot;greater--less-than&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#greater--less-than&quot; aria-label=&quot;greater  less than permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Greater &amp;amp; Less than&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | credit |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    |     13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John     |     21 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    |     11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont   |     37 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    |      6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina |     41 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     |     13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary     |     25 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fullname         | age  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam Smith        |   25 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina Randall |   26 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan Joyce        |   27 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena Shah        |   31 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows full name of students whose age is &lt;strong&gt;greater than or equal to 25&lt;/strong&gt; inclusive&lt;/p&gt;&lt;h3 id=&quot;boolean&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#boolean&quot; aria-label=&quot;boolean permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Boolean&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;99&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 99 &amp;gt; 1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|      1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| -15 &amp;gt; 15 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;1 represents &lt;strong&gt;True&lt;/strong&gt; and 0 represents &lt;strong&gt;false&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;a&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;b&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- false&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;a&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;b&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- true&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;A&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;a&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- false&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;A&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;a&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;--String comparison is case insensitive&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;a&amp;#x27; &amp;gt; &amp;#x27;b&amp;#x27; |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|         0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;a&amp;#x27; &amp;lt; &amp;#x27;b&amp;#x27; |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|         1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;A&amp;#x27; &amp;gt; &amp;#x27;a&amp;#x27; |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|         0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;A&amp;#x27; &amp;gt;= &amp;#x27;a&amp;#x27; |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Avoid&lt;/strong&gt; doing string comparison!&lt;/p&gt;&lt;h2 id=&quot;and-&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#and-&quot; aria-label=&quot;and  permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;AND (&amp;amp;&amp;amp;)&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Min&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Min&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | credit |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis |     13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both yields the same result&lt;/p&gt;&lt;h3 id=&quot;and--like&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#and--like&quot; aria-label=&quot;and  like permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;AND &amp;amp; LIKE&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;%science%&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Show students older than 20, has less than 200 credits, and major doesn&amp;#x27;t include &amp;quot;science&amp;quot;&lt;/p&gt;&lt;h2 id=&quot;or&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#or&quot; aria-label=&quot;or permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;OR(||)&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%sCienCE&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;bioLOGY&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;---------&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%sCienCE&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;bioLOGY&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname  | major            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis  | Computer Science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin | Biology          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam    | Computer Science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad   | Biology          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena   | Food Science     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Again case insensitive. Both yields the same result where it shows students that study biology OR major that includes &amp;quot;science&amp;quot;&lt;/p&gt;&lt;h2 id=&quot;between&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#between&quot; aria-label=&quot;between permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;BETWEEN&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;23&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;---&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | age  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin   |   22 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    |   22 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah |   20 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     |   22 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both yields the same result--shows students between age of 20 and 22 inclusive. &lt;strong&gt;&lt;em&gt;BETWEEN&lt;/em&gt;&lt;/strong&gt; is &lt;strong&gt;inclusive&lt;/strong&gt;!&lt;/p&gt;&lt;h3 id=&quot;not-between&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#not-between&quot; aria-label=&quot;not between permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;NOT BETWEEN&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;23&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | age  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam      |   25 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    |   17 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina |   26 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan      |   27 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary     |   16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena     |   31 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows students whose age is &lt;strong&gt;not&lt;/strong&gt; in between 18 and 23.&lt;/p&gt;&lt;h3 id=&quot;side-note&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#side-note&quot; aria-label=&quot;side note permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Side note&lt;/h3&gt;&lt;p&gt;When using &lt;strong&gt;&lt;em&gt;BETWEEN&lt;/em&gt;&lt;/strong&gt; with date of time, use &lt;strong&gt;&lt;em&gt;CAST()&lt;/em&gt;&lt;/strong&gt; to explicitly convert the values to the desired data types. For example, convert &lt;strong&gt;&lt;em&gt;DATE&lt;/em&gt;&lt;/strong&gt; value to &lt;strong&gt;&lt;em&gt;DATETIME&lt;/em&gt;&lt;/strong&gt; value for comparison&lt;/p&gt;&lt;h2 id=&quot;cast&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#cast&quot; aria-label=&quot;cast permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CAST()&lt;/h2&gt;&lt;p&gt;Converts data types into desired ones&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CAST&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2011-05-05&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATETIME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CAST(&amp;#x27;2011-05-05&amp;#x27; AS DATETIME) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 2011-05-05 00:00:00            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Converts string to DATETIME data type&lt;/p&gt;&lt;h3 id=&quot;example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example&quot; aria-label=&quot;example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthdate  | birthtime | birthdt             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 1956-11-13 | 10:03:33  | 1956-11-13 10:03:33 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 | 04:20:47  | 1967-12-23 04:20:47 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  | 2019-09-29 | 00:44:35  | 2019-09-29 00:44:35 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdt &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;1960-01-01&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2000-03-03&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Above query sill works because MySQL is smart enough to auto convert string to correct data type&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdt &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CAST&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;1960-01-01&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATETIME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CAST&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2000-03-03&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATETIME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This one is correct&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthdt             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 04:20:47 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;in--not-in&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#in--not-in&quot; aria-label=&quot;in  not in permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;IN &amp;amp; NOT IN&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;ellis&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;john&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;diego&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- SAME AS..&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;IN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;ellis&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;john&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;diego&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both do the same. Using &lt;strong&gt;&lt;em&gt;IN&lt;/em&gt;&lt;/strong&gt; is more concise&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;IN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;26&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- SAME result AS..&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| age  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   25 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   19 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   23 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   17 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   27 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   31 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both yields &lt;strong&gt;same results&lt;/strong&gt;&lt;/p&gt;&lt;h2 id=&quot;case&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#case&quot; aria-label=&quot;case permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CASE&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CASE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Teenage&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Twenties&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ELSE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;somethingElse&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; agetype&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+------+---------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | lname    | age  | agetype |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+------+---------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      |   18 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin   | Pema     |   22 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam      | Smith    |   25 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John     | Johnson  |   19 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave     | Smith    |   23 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    | Lang     |   22 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah | Tucker   |   20 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont   | Marks    |   18 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    | Miller   |   17 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina | Randall  |   26 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     | Johnson  |   22 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan      | Joyce    |   27 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary     | Fletcher |   16 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena     | Shah     |   31 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      |   18 | Teenage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+------+---------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Above example is not expected. We can see that &lt;strong&gt;second WHEN&lt;/strong&gt; is like &lt;strong&gt;else if&lt;/strong&gt; statement. It won&amp;#x27;t be executed since the first statement was true&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CASE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Teenage&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;BETWEEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;AND&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;29&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Twenties&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ELSE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;idk&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; agetype&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- MORE SUCCINT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CASE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Teenage&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Twenties&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ELSE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;idk&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; agetype&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | lname    | age  | agetype  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      |   18 | Teenage  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin   | Pema     |   22 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam      | Smith    |   25 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John     | Johnson  |   19 | Teenage  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave     | Smith    |   23 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    | Lang     |   22 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah | Tucker   |   20 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont   | Marks    |   18 | Teenage  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    | Miller   |   17 | Teenage  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina | Randall  |   26 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     | Johnson  |   22 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan      | Joyce    |   27 | Twenties |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary     | Fletcher |   16 | Teenage  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena     | Shah     |   31 | idk      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      |   18 | Teenage  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Below is more concise and &lt;strong&gt;preferred&lt;/strong&gt; but be sure to avoid previous mistakes&lt;/p&gt;&lt;h3 id=&quot;when--or&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#when--or&quot; aria-label=&quot;when  or permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;WHEN &amp;amp;&amp;amp; OR&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CASE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Biology&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%science&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;THEN&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;bio or science&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ELSE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;others&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;END&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;bio&amp;amp;science&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | lname    | bio&amp;amp;science    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      | bio or science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin   | Pema     | bio or science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam      | Smith    | bio or science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John     | Johnson  | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave     | Smith    | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    | Lang     | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah | Tucker   | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont   | Marks    | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    | Miller   | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina | Randall  | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     | Johnson  | bio or science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan      | Joyce    | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary     | Fletcher | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena     | Shah     | bio or science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      | others         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;if&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#if&quot; aria-label=&quot;if permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;IF&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;IF&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;biology&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%science&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;bio or science&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;others&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;bio&amp;amp;science&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Yields the same result as previous query&lt;/li&gt;&lt;li&gt;IF(&lt;em&gt;condition&lt;/em&gt;, &lt;em&gt;then..&lt;/em&gt;, &lt;em&gt;else&lt;/em&gt;)&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Data Types]]></title><description><![CDATA[Introduction to various data types and functions with date and time]]></description><link>https://ellismin.com/2019/09/sql-data-types/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-data-types/</guid><pubDate>Sat, 28 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;varchar--char&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#varchar--char&quot; aria-label=&quot;varchar  char permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;VARCHAR &amp;amp; CHAR&lt;/h2&gt;&lt;p&gt;CHAR has a &lt;strong&gt;fixed length&lt;/strong&gt;. If the length of data is too long, it will &lt;strong&gt;truncate&lt;/strong&gt;. If it is too short, it will &lt;strong&gt;add spaces&lt;/strong&gt;(right-pads) to the fixed length. However, when CHAR values are retrieved, trailing spaces are removed unless &lt;strong&gt;&lt;em&gt;PAD_CHAR_TO_FULL_LENGTH&lt;/em&gt;&lt;/strong&gt; SQL mode is enabled&lt;/p&gt;&lt;p&gt;VARCHAR &amp;amp; CHAR can be any value from &lt;strong&gt;0 to 255&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;CHAR is &lt;strong&gt;faster&lt;/strong&gt; for fixed length text. Example:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;State abbreviations: WI, CA&lt;/li&gt;&lt;li&gt;Gender: M/F&lt;/li&gt;&lt;li&gt;Yes/No flags: Y/N&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Otherwise, &lt;strong&gt;use VARCHAR!&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;CHAR vs VARCHAR comparison for &lt;strong&gt;storage&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Value     | CHAR(4) | Storage  | VARCHAR(4) | Storage |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;&amp;#x27;        | &amp;#x27;    &amp;#x27;  | 4 bytes  | &amp;#x27;&amp;#x27;         | 1 byte  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;ab&amp;#x27;      | &amp;#x27;ab  &amp;#x27;  | 4 bytes  | &amp;#x27;ab&amp;#x27;       | 3 byte  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;abcd&amp;#x27;    | &amp;#x27;abcd&amp;#x27;  | 4 bytes  | &amp;#x27;abcd&amp;#x27;     | 5 byte  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| &amp;#x27;abcdefg&amp;#x27; | &amp;#x27;abcd&amp;#x27;  | 4 bytes  | &amp;#x27;abcdefg&amp;#x27;  | 5 byte  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Note that CHAR uses &lt;strong&gt;slightly less memory&lt;/strong&gt; when the character length is 4 (4 bytes vs 5 bytes)&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;decimals&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#decimals&quot; aria-label=&quot;decimals permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Decimals&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    somedecimal &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DECIMAL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;5 is &lt;strong&gt;total number of digits&lt;/strong&gt; both before and after .&lt;/li&gt;&lt;li&gt;2 is &lt;strong&gt;digits after&lt;/strong&gt; decimal point&lt;/li&gt;&lt;li&gt;Example: &lt;strong&gt;999.99&lt;/strong&gt; (highest possible value)&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example&quot; aria-label=&quot;example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; somedecimal&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; price &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DECIMAL&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- Insert data&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; somedecimal &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; somedecimal &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;31231233&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; somedecimal &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;77.77&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; somedecimal &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;123.8888&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; somedecimal &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1.9999&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| price  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   3.00 | &amp;lt;- Two decimals given 2nd parameter&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 999.99 | &amp;lt;- Changed to largest possible #&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  77.77 | &amp;lt;- Unchanged&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 123.89 | &amp;lt;- Rounded up&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|   2.00 | &amp;lt;- Also rounded&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;float--double&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#float--double&quot; aria-label=&quot;float  double permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;FLOAT &amp;amp; DOUBLE&lt;/h2&gt;&lt;p&gt;DECIMALs calculations are &lt;strong&gt;exact&lt;/strong&gt; while FLOAT or DOUBLE calculations are &lt;strong&gt;approximate&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;FLOAT &amp;amp; Double store larger numbers using less space but it comes at the cost of &lt;strong&gt;precision&lt;/strong&gt;--they won&amp;#x27;t be as accurate as DECIMALS.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+---------------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Data Type | Memory Needed | Precision Issues |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+---------------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| FLOAT     | 4 Bytes       | ~7 digits        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| DOUBLE    | 8 Bytes       | ~15 digits       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+---------------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Try using &lt;strong&gt;&lt;em&gt;DECIMALS&lt;/em&gt;&lt;/strong&gt; unless you know that &lt;strong&gt;precision doesn&amp;#x27;t matter&lt;/strong&gt;.&lt;/p&gt;&lt;h3 id=&quot;example-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-1&quot; aria-label=&quot;example 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stuff&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;price &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FLOAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stuff &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;77.43&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stuff &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;9977.45&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stuff &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;12345.67&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; stuff &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5544332211.11&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| price      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|      77.43 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    9977.45 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|    12345.7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 5544330000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Notice the &lt;strong&gt;precision&lt;/strong&gt;. It doesn&amp;#x27;t just truncate it, but stores different number&lt;/p&gt;&lt;h2 id=&quot;dates--times&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#dates--times&quot; aria-label=&quot;dates  times permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Dates &amp;amp; Times&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;DATE&lt;/em&gt;&lt;/strong&gt;: Stores date without time in format of &lt;strong&gt;YYYY-MM-DD&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;TIME&lt;/em&gt;&lt;/strong&gt;: Store time without date in format of &lt;strong&gt;HH:MM:SS&lt;/strong&gt;. Not as common as &lt;strong&gt;&lt;em&gt;DATE&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;DATETIME&lt;/em&gt;&lt;/strong&gt;: Store both in formate of &lt;strong&gt;YYYY-MM_DD HH:MM:SS&lt;/strong&gt;. Very commonly used.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h3 id=&quot;example-2&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-2&quot; aria-label=&quot;example 2 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  name &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  birthdate &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  birthtime  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  birthdt &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DATETIME&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Paul&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;1956-11-13&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;10:03:33&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;1956-11-13 10:03:33&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Larry&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;1967-12-23&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;04:20:47&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;1967-12-23 04:20:47&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthdate  | birthtime | birthdt             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 1956-11-13 | 10:03:33  | 1956-11-13 10:03:33 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 | 04:20:47  | 1967-12-23 04:20:47 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;curdate-curtime-now&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#curdate-curtime-now&quot; aria-label=&quot;curdate curtime now permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CURDATE, CURTIME, NOW&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;John&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CURDATE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CURTIME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthdate  | birthtime | birthdt             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 1956-11-13 | 10:03:33  | 1956-11-13 10:03:33 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 | 04:20:47  | 1967-12-23 04:20:47 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  | 2019-09-29 | 00:44:35  | 2019-09-29 00:44:35 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;CURDATE() - gives current date&lt;br/&gt;
CURTIME() - gives current time&lt;br/&gt;
NOW() - gives both current date and time&lt;/p&gt;&lt;h2 id=&quot;formating-date--times&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#formating-date--times&quot; aria-label=&quot;formating date  times permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Formating Date &amp;amp; Times&lt;/h2&gt;&lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html&quot; target=&quot;_blank&quot;&gt;List of DATE and TIME functions&lt;/a&gt;&lt;h3 id=&quot;extract-elements-from-date&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#extract-elements-from-date&quot; aria-label=&quot;extract elements from date permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extract elements from Date&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;YEAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;MONTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DAY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------------+------------------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthdate  | YEAR(birthdate) | MONTH(birthdate) | DAY(birthdate) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------------+------------------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 1956-11-13 |            1956 |               11 |             13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 |            1967 |               12 |             23 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  | 2019-09-29 |            2019 |                9 |             29 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------------+------------------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;YEAR()&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;MONTH()&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;DAY()&lt;/em&gt;&lt;/strong&gt; extracts certain information from &lt;strong&gt;&lt;em&gt;DATE&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DAYNAME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; DAYOFWEEK&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DAYOFYEAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+--------------------+----------------------+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthdate  | DAYNAME(birthdate) | DAYOFWEEK(birthdate) | DAYOFYEAR(birthdate) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+--------------------+----------------------+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 1956-11-13 | Tuesday            |                    3 |                  318 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 | Saturday           |                    7 |                  357 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  | 2019-09-29 | Sunday             |                    1 |                  272 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+--------------------+----------------------+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;More examples for &lt;strong&gt;&lt;em&gt;DAYNAME()&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;DAYOFWEEK()&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;DAYOFYEAR()&lt;/em&gt;&lt;/strong&gt;. There are also &lt;strong&gt;&lt;em&gt;MONTHNAME&lt;/em&gt;&lt;/strong&gt; and many more.&lt;/p&gt;&lt;h3 id=&quot;extract-elements-from-time&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#extract-elements-from-time&quot; aria-label=&quot;extract elements from time permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Extract elements from Time&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;HOUR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;MINUTE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SECOND&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthtime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-----------+-----------------+-------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthtime | HOUR(birthtime) | MINUTE(birthtime) | SECOND(birthtime) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-----------+-----------------+-------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 10:03:33  |              10 |                 3 |                33 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 04:20:47  |               4 |                20 |                47 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  | 00:44:35  |               0 |                44 |                35 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-----------+-----------------+-------------------+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;more&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more&quot; aria-label=&quot;more permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;MONTHNAME&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DAY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;YEAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;dif format&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Above is &lt;strong&gt;not efficient&lt;/strong&gt;. You can use &lt;strong&gt;&lt;em&gt;DATE_FOTMAT&lt;/em&gt;&lt;/strong&gt; instead&lt;/p&gt;&lt;h3 id=&quot;date_format&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#date_format&quot; aria-label=&quot;date_format permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DATE_FORMAT&lt;/h3&gt;&lt;p&gt;Besides using the methods above, there is also a convenient way of using &lt;strong&gt;&lt;em&gt;DATE_FORMAT&lt;/em&gt;&lt;/strong&gt;. &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format&quot; target=&quot;_blank&quot;&gt;Reference&lt;/a&gt; and examples are below:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DATE_FORMAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2009-08-15 23:53:00&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;%W, %M, %Y&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;date&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| date                   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Saturday, August, 2009 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DATE_FORMAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;%M %D at %l:%i&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| DATE_FORMAT(now(), &amp;#x27;%M %D at %l:%i&amp;#x27;) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| September 29th at 3:28               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DATE_FORMAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;2009-08-15 23:53:00&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;%W-%M-%Y&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;date&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| date                 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Saturday-August-2009 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    DATE_FORMAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; was born on  %W&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fact&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fact                        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul was born on  Tuesday   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry was born on  Saturday |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John was born on  Sunday    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DATE_FORMAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;%Y-%m-%d&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; formatted&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | formatted  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 1956-11-13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  | 2019-09-29 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;datediff--date_add&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#datediff--date_add&quot; aria-label=&quot;datediff  date_add permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DATEDIFF &amp;amp; DATE_ADD&lt;/h2&gt;&lt;p&gt;You can apply math on dates. &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_datediff&quot; target=&quot;_blank&quot;&gt;Reference&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;datediff&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#datediff&quot; aria-label=&quot;datediff permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DATEDIFF&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    DATEDIFF&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;days-old&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name  | birthdate  | dayslived |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Paul  | 1956-11-13 |     22965 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Larry | 1967-12-23 |     18908 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John  | 2019-09-29 |         0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+------------+-----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;date_add&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#date_add&quot; aria-label=&quot;date_add permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DATE_ADD&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; DATE_ADD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTERVAL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;MONTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Month added&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    DATE_ADD&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;birthdt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTERVAL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SECOND&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Seconds added&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+---------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| birthdt             | Month added         | Seconds added       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+---------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 1956-11-13 10:03:33 | 1956-12-13 10:03:33 | 1956-11-13 10:03:43 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 1967-12-23 04:20:47 | 1968-01-23 04:20:47 | 1967-12-23 04:20:57 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 2019-09-29 00:44:35 | 2019-10-29 00:44:35 | 2019-09-29 00:44:45 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+---------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;---&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#---&quot; aria-label=&quot;    permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;+ &amp;amp; -&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; birthdt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTERVAL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;MONTH&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTERVAL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;YEAR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;added dates&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ppl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| birthdt             | added dates         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 1956-11-13 10:03:33 | 1966-10-13 10:03:33 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 1967-12-23 04:20:47 | 1977-11-23 04:20:47 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| 2019-09-29 00:44:35 | 2029-08-29 00:44:35 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;timestamps&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#timestamps&quot; aria-label=&quot;timestamps permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;TIMESTAMPS&lt;/h2&gt;&lt;p&gt;Adding in time stamps in our table--meta data showing when something was created or updated. In &lt;strong&gt;MySQL&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;TIMESTAMP&lt;/em&gt;&lt;/strong&gt; is also a data type&lt;/p&gt;&lt;p&gt;&lt;strong&gt;DATETIME*&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;TIMESTAMP&lt;/em&gt;&lt;/strong&gt; both store date and time with two differences in ranges&lt;/p&gt;&lt;ol&gt;&lt;li&gt;1000-01-01 00:00:00 to 9999-12-31 23:59:59&lt;/li&gt;&lt;li&gt;1970-01-01 00:00:01 to 2038-01-19 03:14:07&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;TIMESTAMP exists on top of DATETIME because it &lt;strong&gt;takes up less space&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;In sum&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;DATETIME&lt;/em&gt;&lt;/strong&gt; covers wider range of dates, but &lt;strong&gt;&lt;em&gt;TIMESTAMP&lt;/em&gt;&lt;/strong&gt; takes up less memory.&lt;/p&gt;&lt;h3 id=&quot;example-3&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-3&quot; aria-label=&quot;example 3 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    content &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;--TIMESTAMP can be replaced with DATETIME but takes MORE space&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Lol haha&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;I love this post&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| content          | created_at          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lol haha         | 2019-09-29 01:50:40 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| I love this post | 2019-09-29 01:50:40 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;zjxcn&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; created_at&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| content          | created_at          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lol haha         | 2019-09-29 01:50:40 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| I love this post | 2019-09-29 01:50:40 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| zjxcn            | 2019-09-29 01:52:28 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Orders by time created in ascending order. However, this will show in ascending order by default &lt;strong&gt;without ORDER BY&lt;/strong&gt; because &lt;strong&gt;&lt;em&gt;created_at&lt;/em&gt;&lt;/strong&gt; was set with &lt;strong&gt;&lt;em&gt;NOW()&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;h2 id=&quot;on-update&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#on-update&quot; aria-label=&quot;on update permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ON UPDATE&lt;/h2&gt;&lt;p&gt;Not used very commonly but you can do things like&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; intUp &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; changeInt &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Every time &lt;strong&gt;&lt;em&gt;intUP&lt;/em&gt;&lt;/strong&gt; row gets updated, it will change to 3&lt;/p&gt;&lt;h3 id=&quot;with-date&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#with-date&quot; aria-label=&quot;with date permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;With date&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    content &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    changed_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ON&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Lol haha&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;I love this post&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;loloolol&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| content          | changed_at          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lol haha         | 2019-09-29 01:58:10 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| I love this post | 2019-09-29 01:58:20 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| loloolol         | 2019-09-29 01:59:31 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;try-updating&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#try-updating&quot; aria-label=&quot;try updating permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Try updating&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; comments2 &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; content&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Trying to edit comment&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; content&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Lol haha&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| content                | changed_at          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Trying to edit comment | 2019-09-29 02:03:07 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| I love this post       | 2019-09-29 01:58:20 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| loloolol               | 2019-09-29 01:59:31 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that &lt;strong&gt;&lt;em&gt;changed_at&lt;/em&gt;&lt;/strong&gt; &lt;strong&gt;automatically got updated to NOW()&lt;/strong&gt;. Also it doesn&amp;#x27;t show in ascending order of time by default anymore&lt;/p&gt;&lt;h3 id=&quot;more-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-example&quot; aria-label=&quot;more example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tweets&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    content &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    username &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    created_at &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; tweets&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; username&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;hahaahhaa&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;ooasd&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| content   | username | created_at          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| hahaahhaa | ooasd    | 2019-09-29 03:33:05 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+----------+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[JS]: Destructuring Example]]></title><description><![CDATA[Without Destructuring (ES5) Destructuring (ES6^) Destructuring Array Destructuring Objects Destructuring return value of function Value vs…]]></description><link>https://ellismin.com/2019/09/js-destructuring/</link><guid isPermaLink="false">https://ellismin.com/2019/09/js-destructuring/</guid><pubDate>Fri, 27 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;without-destructuring-es5&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#without-destructuring-es5&quot; aria-label=&quot;without destructuring es5 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Without Destructuring (ES5)&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Array&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;John&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: &amp;quot;John&amp;quot; 25&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Object&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;John&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: &amp;quot;John&amp;quot; 25&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;destructuring-es6&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#destructuring-es6&quot; aria-label=&quot;destructuring es6 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Destructuring (ES6^)&lt;/h2&gt;&lt;h3 id=&quot;destructuring-array&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#destructuring-array&quot; aria-label=&quot;destructuring array permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Destructuring Array&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;John&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Skipping first item&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: &amp;quot;John&amp;quot; 25&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age_&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: 25&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;destructuring-objects&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#destructuring-objects&quot; aria-label=&quot;destructuring objects permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Destructuring Objects&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;John&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Setting Alias&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: &amp;quot;John&amp;quot; 25&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: &amp;quot;John&amp;quot; 25&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;destructuring-return-value-of-function&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#destructuring-return-value-of-function&quot; aria-label=&quot;destructuring return value of function permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Destructuring return value of function&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Function returning an array&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;calcAgeAndRetirement&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;year&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;getFullYear&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; year&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;65&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Destructuring returned array&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; yearsTillRetirement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;calcAgeAndRetirement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1990&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; yearsTillRetirement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;value-vs-reference&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#value-vs-reference&quot; aria-label=&quot;value vs reference permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Value vs Reference&lt;/h2&gt;&lt;p&gt;Destructuring features work &lt;strong&gt;by reference&lt;/strong&gt;, not by copying the value.&lt;/p&gt;&lt;p&gt;You can also refer to &lt;a href=&quot;/2019/09/js-primitive-reference&quot;&gt;[JS]: Primitive vs Reference&lt;/a&gt; post.&lt;/p&gt;&lt;h3 id=&quot;example-1-array&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-1-array&quot; aria-label=&quot;example 1 array permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 1 (Array)&lt;/h3&gt;&lt;p&gt;Reassigning the elements of either original or destructured array does not affect the value of another&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: 1 2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: 1 2&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;arr&lt;/code&gt; and &lt;code&gt;[a, b]&lt;/code&gt; points to the same array&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:548px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:44.18604651162791%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABgUlEQVQoz32SQU/CQBCF+f9nzxw86NGDiUYxikZFhRJRCSrQIkUKYi2l22632/Kc3YIKRl+ymW6z87230xaw0Hw+19WbzlC5usbQGeM/9QevqBl1cJEsCZpR+AnjMxfRuw3PMRG8vSD8cCCEgJQSSZLoGscczH3FlM5M7Gf4IwsR9aVZphkrwGDUBbcN9BsnCF8MBPYDOOcapsAJAaOQ4cM00Kke4PFqH5PHczLvgccCaSrXgO8DuFYDw3YdE/MW02H7K6GUCTWkZBDB7bfgPJNxq4pxp47AdSi50MYrwGhiwetUyL2UOw+aCMMQMUF5HBM8AQtmcClht3aIVmUPTvMUjMYz9WfaeAWYphm5SJ0kW8zkL6meLJtD0lnV7vv+N/AndCmfkjXMHu57fV2NpzZuuxbuaK/esYh/9anled7vhLlrnswajVE8PsP25Q2KR2Vs7OyiWCpj6+IGm+VzmPYAgsbAyFiNhTH2/dusX0VJgYX6uouVyDR/Fvl+/UZLfQLpVa70OiVKQQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/6f66f892ba4cc306e082329d045935ad/a58fe/1.png&quot; srcSet=&quot;/static/6f66f892ba4cc306e082329d045935ad/2eb24/1.png 215w,/static/6f66f892ba4cc306e082329d045935ad/05ed2/1.png 430w,/static/6f66f892ba4cc306e082329d045935ad/a58fe/1.png 548w&quot; sizes=&quot;(max-width: 548px) 100vw, 548px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// OR arr[0] = 10; arr[1] = 20;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: 10 20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: 1 2&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;arr = [10, 20]&lt;/code&gt; or &lt;code&gt;arr[0] = 10; arr[1] = 20;&lt;/code&gt; operation creates a new array in the heap &amp;amp; points to it, hence it doesn&amp;#x27;t affect the array value of destructured array, &lt;code&gt;[a, b]&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:549px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:64.65116279069768%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAACEElEQVQ4y32S2W7bQAxF/f+/UKAPBfzQpkDzEDRBAiR26xjxJm+RjUROvMi7JVn7rrnlKN7rlhDBgTC8PEMyg40xxtJomBZ+F4qQxxP8z97e+6gKdYRRvM8nzxyKBY4JV5tBmw1grmR4hoIoChHH8c7DIICrL2AsZSzlHixlgpDywNLvWNBeDuDLNcitBziDCiy5BcdxEJCI7/sUQ9iWAa1XRq98jdfSNZSXAtzlCPADsCQ5EdTmUAdtzHoNrPot6NMewnBPmFBC4HtQR11MXwWMX2pYvjdh6QoYF4yiY0FXGUKXipDKN1h08imhbdspnet5FAOYhg5FKqWEnccrzMUcTCL0DHo2FT0S5BT8eZwqomofXTljdH/XU/4CIvd0fS94KLo1m4jagxHE0Rit/hB16S2Nz0MZHfrnUeGtJZTrrtd0OOkhj7xP3CaKiuyvIr6XasjmH/Hp6gbZXAEXT1V8LTxBni/SiTuum7YjsKxjwlNSlXpy32wj/9zBXbWO20otjbl2B/mWCMt2Pu5vAECi7JxgshGcqhq+Fcv4Uanjy90DPv+8pXiPy2oDl2UB88k0FaFJgdFqMYrY7uEpIds0PuGrQo5NEd4On0Q8eqZhmlgptPhxfJSbOT9E9tdUufGJCoKAbrcLSZLQbDQgiiLWNBBN0/5NuCM98C2hqqpY04p4RGoYBnQ6c7f4UMj+ANYt306nwgG7AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/bbacff23413a4c958b5d41bbdaef4e0a/928ea/2.png&quot; srcSet=&quot;/static/bbacff23413a4c958b5d41bbdaef4e0a/2eb24/2.png 215w,/static/bbacff23413a4c958b5d41bbdaef4e0a/05ed2/2.png 430w,/static/bbacff23413a4c958b5d41bbdaef4e0a/928ea/2.png 549w&quot; sizes=&quot;(max-width: 549px) 100vw, 549px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;a &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;b &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: 1 2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: 10 20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;p&gt;Similarly, &lt;code&gt;a = 10; b = 20;&lt;/code&gt; operation creates new array heap, leaving the values of &lt;code&gt;arr&lt;/code&gt; intact.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:549px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:64.65116279069768%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAACEElEQVQ4y32S2W7bQAxF/f+/UKAPBfzQpkDzEDRBAiR26xjxJm+RjUROvMi7JVn7rrnlKN7rlhDBgTC8PEMyg40xxtJomBZ+F4qQxxP8z97e+6gKdYRRvM8nzxyKBY4JV5tBmw1grmR4hoIoChHH8c7DIICrL2AsZSzlHixlgpDywNLvWNBeDuDLNcitBziDCiy5BcdxEJCI7/sUQ9iWAa1XRq98jdfSNZSXAtzlCPADsCQ5EdTmUAdtzHoNrPot6NMewnBPmFBC4HtQR11MXwWMX2pYvjdh6QoYF4yiY0FXGUKXipDKN1h08imhbdspnet5FAOYhg5FKqWEnccrzMUcTCL0DHo2FT0S5BT8eZwqomofXTljdH/XU/4CIvd0fS94KLo1m4jagxHE0Rit/hB16S2Nz0MZHfrnUeGtJZTrrtd0OOkhj7xP3CaKiuyvIr6XasjmH/Hp6gbZXAEXT1V8LTxBni/SiTuum7YjsKxjwlNSlXpy32wj/9zBXbWO20otjbl2B/mWCMt2Pu5vAECi7JxgshGcqhq+Fcv4Uanjy90DPv+8pXiPy2oDl2UB88k0FaFJgdFqMYrY7uEpIds0PuGrQo5NEd4On0Q8eqZhmlgptPhxfJSbOT9E9tdUufGJCoKAbrcLSZLQbDQgiiLWNBBN0/5NuCM98C2hqqpY04p4RGoYBnQ6c7f4UMj+ANYt306nwgG7AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/bbacff23413a4c958b5d41bbdaef4e0a/928ea/2.png&quot; srcSet=&quot;/static/bbacff23413a4c958b5d41bbdaef4e0a/2eb24/2.png 215w,/static/bbacff23413a4c958b5d41bbdaef4e0a/05ed2/2.png 430w,/static/bbacff23413a4c958b5d41bbdaef4e0a/928ea/2.png 549w&quot; sizes=&quot;(max-width: 549px) 100vw, 549px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;example-2-object&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-2-object&quot; aria-label=&quot;example 2 object permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 2 (Object)&lt;/h3&gt;&lt;p&gt;Similar to &lt;code&gt;Example 1&lt;/code&gt;, modifying the following property of object does not affect the value of another&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: B 20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: A 10&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: A 10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: B 20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;example-3&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-3&quot; aria-label=&quot;example 3 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 3&lt;/h3&gt;&lt;p&gt;Contrast to &lt;code&gt;Example 1&lt;/code&gt; and &lt;code&gt;Example 2&lt;/code&gt;, modifying the inner element of array/object also affects the elements inside another.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: [1, 2] { name: &amp;quot;A&amp;quot;, age: 10}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: [1, 2] { name: &amp;quot;A&amp;quot;, age: 10}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:547px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:57.20930232558139%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB8UlEQVQoz42SbU/aUBiG/f//YYnu1Yws7oMmKgOdFRhiLSCIMN4UUcDSUih9b68dKjicy7Inae+k5znXuZ+7Z4NlRVEUq25MOTuXGYxU/lWtdpfyZYUw+v1twdhYh1n6AGvUYtJvMB+2MNUetm3jui6O4wj1sOYm04cm6m2NUbfK9L6BaYwJgjBmvADOhm3M2wtuLyWhCtP+dQwJggDf9wnCEHs+4/FngUYhSVNOobfOmI0fsB33L8DRDeOWTL+WZyQ2GeL0lUNXOPQ8D3NmoLaL9Ko5upcZHpvnGOqAuWW/BlrjHpOuEjeqAmyKsR0B84S7BczzA2zLZNwp0S5JNJUTtI7CTBuiT4x1YPyOA14P+X8rEJsmuv4EXLmLVTxR9BTuQNNJliqcXNU5lIvsFy5IKiWOq9d8r1xhzKaEy2wdx0bTtCWQ6MW1WWlfHbMt5Uhk8rw9SPE+mWZr/xs7eZndgsJIrHsijkXGlmXFOb/KMBLWFwY918cyRZNojgL/xXiuCN9f/tE/K76HK5jrOUiNQ/aUz3xKv2G3uE1zUIvXfAFNl/dISJt8/fGRxOkWX7Lv2Ml9EBNsUr+rxH2hcPMM9H2P6p1CoXnKWV1C7mS413pPjWFAuXPOsXJAtnqE3M4ilVNkKkdka0fcqTfPDn8B3DU8r2/QEF8AAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/d9a312fcd17b969915d72958576835a5/977f7/4.png&quot; srcSet=&quot;/static/d9a312fcd17b969915d72958576835a5/2eb24/4.png 215w,/static/d9a312fcd17b969915d72958576835a5/05ed2/4.png 430w,/static/d9a312fcd17b969915d72958576835a5/977f7/4.png 547w&quot; sizes=&quot;(max-width: 547px) 100vw, 547px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: [10, 2] { name: &amp;quot;B&amp;quot;, age: 10}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: [10, 2] { name: &amp;quot;B&amp;quot;, age: 10}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: [10, 2] { name: &amp;quot;B&amp;quot;, age: 10}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Output: [10, 2] { name: &amp;quot;B&amp;quot;, age: 10}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:545px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:75.34883720930233%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAACl0lEQVQ4y42U+1PaQBDH/f9/d8Zp66vtVBmrVTvVFhUs0BHB8BBFCGB4BAiPkIS8yAO+3YSHok6nO3Ozk8ve5/a7t3crmNlkMvG9oupI3DBoC138y2p1HtncHZzx05zHWHkOM+QOjG4FEl+E3ilD69UxGo1g2zYsy/K9oWsYtisQ6w8QHu+gNClW7sN1PfILoNqtwmhk0MhFoTfSUJsPPtBxHB/muC5MQ4NYYVBhLlCmMShfQxNbMEcWQd0XwF4DfQrmH67RLSUh0+7zDG3K0APrmoo+lwWfj4O7jaHDJqENSJk53XhZsshD5hhUs1H0yxQosDBN80kyLTB0FQMuQzERlFJh9EsJ6AMBsjJ8nuG0qGPyXikmmI7/sfmZKLI8Bc6zm/rJItseBYRzecQKLC7StzhjMghlcojki4jeF6gbVIodE8TxQZIkzYCYLLXNeOZb4gC7sTj2/sSx/escn4IX2Pp5hoNrBkeJFFrdLpVhBMMw/OGVxrOlGk48zZ5sx6Xi6zB1HY5tLUk0aN6mg3rTaO1Csu3YuOGiCN4e4SD6BcHcISqdgv/PHbu4KoRxHA/glDnAYXwXP5JfcZLcx/dEAAU+N1M3fgakkwzfn2AvtoFAaB37iW3c1VIL4Fn6GB/P1xD4vYFvkU3shN5j53Idn0NryDwmXwMtkhZmf+LkahOHp6vYS2whz6cXwPPsMbaCqwT5gEh0nYDvCEbjkoBc4jXQ80NdgaSKEPptyNoAlvNUv6GmoEcNPBiKaPWaaHWaUDQJii7BtIy373KtWsMNPQylUhncI+ffkrl1hA4YJoVioYh6rQGWLUFoC3j5uPgZzj8kWUKRLaJarUKmPlSp1+amKAra7TYEQUCXWsb758UvdQn5v4P8Y9njCYSEAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/7ca0eda1b82cecb38df8f36b202b3701/3ddad/5.png&quot; srcSet=&quot;/static/7ca0eda1b82cecb38df8f36b202b3701/2eb24/5.png 215w,/static/7ca0eda1b82cecb38df8f36b202b3701/05ed2/5.png 430w,/static/7ca0eda1b82cecb38df8f36b202b3701/3ddad/5.png 545w&quot; sizes=&quot;(max-width: 545px) 100vw, 545px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[JS]: Primitive vs Reference]]></title><description><![CDATA[Different data types in JavaScript Primitive Values (Stored in  Stack ) String Number Boolean Undefined Null Symbol (ES6) Reference Values…]]></description><link>https://ellismin.com/2019/09/js-primitive-reference/</link><guid isPermaLink="false">https://ellismin.com/2019/09/js-primitive-reference/</guid><pubDate>Fri, 27 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h3 id=&quot;different-data-types-in-javascript&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#different-data-types-in-javascript&quot; aria-label=&quot;different data types in javascript permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Different data types in JavaScript&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Primitive Values (Stored in &lt;strong&gt;Stack&lt;/strong&gt;)&lt;/p&gt;&lt;ul&gt;&lt;li&gt;String&lt;/li&gt;&lt;li&gt;Number&lt;/li&gt;&lt;li&gt;Boolean&lt;/li&gt;&lt;li&gt;Undefined&lt;/li&gt;&lt;li&gt;Null&lt;/li&gt;&lt;li&gt;Symbol (ES6)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Reference Values (Stored in &lt;strong&gt;Heap&lt;/strong&gt;)&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Array&lt;/li&gt;&lt;li&gt;Object&lt;/li&gt;&lt;li&gt;Function&lt;/li&gt;&lt;li&gt;...&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&lt;p&gt;Data in stack can be access relative quicker than data in heap&lt;/p&gt;&lt;p&gt;But, heap is able to hold more information compared to stack&lt;/p&gt;&lt;/blockquote&gt;&lt;h3 id=&quot;primitive-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#primitive-example&quot; aria-label=&quot;primitive example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Primitive Example&lt;/h3&gt;&lt;p&gt;Variables containing primitives hold data inside of variable itself.&lt;/p&gt;&lt;p&gt;For example below, by assigning &lt;code&gt;name2 = name&lt;/code&gt;, the value of &amp;quot;Jon&amp;quot; gets &lt;strong&gt;copied&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Jon&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Jon&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;let&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name2 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Jon&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Sam&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;name2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Jon&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What happens behind the scene:&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:461px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:67.44186046511628%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAABp0lEQVQ4y4VT227aQBDl/z8lz1Uf2kZR+xBXJRAQESkhamoI9RWvvZdZQ6lOZtfC4d6Ho5ndmTlzZuztZFkGKSXKskRVVXsQosSyEJDKoJLK++7uMM/VKqWwWCzQEUKAiGCM2QMZjTA1mMZ/cTsM0R3/wXOywSwlzjdH+dZaJEmCTlEU/kJr3cBYRs1FNV6SGpNog2A0R/cxxlO0RhhrGK04d4umzonyhFuFDRkrkwmomqNahtAlWxH5JoYbSEWQ3MzYNbRdQdOqFdMq3Ce0WIshbHyNSe8Kq/QG9fIeURQhy3IoEaPOn6HjJ1A6bXxVci2PfEqh34euQFqgtpJ94c+GY3Ga43Xaw7/ZVyTDD6h+fsJm/o2nSFkInSH0KqkBd2180+7IekisrPIgI9sdnhnZeNJD+BhZqPw35vcfEY2+4OWO7cNnkFpynC6MfAI+5giLBdLpd+S/7hBNArY/mFBc3uGuPQKvgGztYevG6ktfeU+R+4WIWmzPh83MpR3ukrmn1O/3PYIgQBiGGAwGGI/H7zvfwX8JnXUxB/eatmf3dndVHv7YbxZv3K+e08uiAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/f37b35110cc0481d042176865f321a6d/f816d/1.png&quot; srcSet=&quot;/static/f37b35110cc0481d042176865f321a6d/2eb24/1.png 215w,/static/f37b35110cc0481d042176865f321a6d/05ed2/1.png 430w,/static/f37b35110cc0481d042176865f321a6d/f816d/1.png 461w&quot; sizes=&quot;(max-width: 461px) 100vw, 461px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:461px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:71.62790697674419%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB9ElEQVQ4y5VS23LaQAzN/39JnzvtQ2bS0gcGZpI4OKHhUmgC67sNttfeXS+X9FS7tAQYkmkfzkjWSkdHsi6yLAPnHGVZHoETiqLAMi9Q1QK8qsnPKbZ7O82vqgpBEODCFCmlIKU8gpICLJWYJht0H+a4HUbkb23MvJ3mN02DJElwkVNXExBC7CAVQVMTjedEYxy9oHPPcP0YYhxvMUs1JL0JA2mwqzWiLOFfhTsy6lanUNxHlXuoSx+8iG2x0mvUnJovGcSCkfWgKEfUnGpJ4XnCBuvCRRNfYXz7Aav0K1Z5D77vww8ipPMH/GItJPcfUY0usfW+QZSpneosoR2dOipRYrMyaktKFDZxzjxkwQQ6dCB9B01wBx31IKvl24TmQfMnyIWL8KkLmbnQ1TPiOEacZIhn34HEwWLUgpx1rC949g6hUFjxCUR6g9nwCyRZlY+QprTXhvaYM7C7T0gerzB3PiPqX0LVS1v39sjCnAEp1Svr776lVVEtfSQ/ush+3iAcdsheE2Hxzk+xpGLva633MDmmyXqzIbUNGhNrXs9mf4enZ/OqVNjLN/A8D+ZewzBEFEVHdyv/2LOE8oCwrmv0+30Lx3Es6WAwwGQyOZpI/Cuhsa7rotfrod1uW7LpdIpWqwXGmF3DfxMe4mjMgzx5ssPfUuQh+EZ9VkMAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/333f5686b04f35b2c723d3c820761f05/f816d/2.png&quot; srcSet=&quot;/static/333f5686b04f35b2c723d3c820761f05/2eb24/2.png 215w,/static/333f5686b04f35b2c723d3c820761f05/05ed2/2.png 430w,/static/333f5686b04f35b2c723d3c820761f05/f816d/2.png 461w&quot; sizes=&quot;(max-width: 461px) 100vw, 461px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:461px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:71.62790697674419%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAACGUlEQVQ4y4VT2XLaQBDk/78kr6lKHpJK4rLLAXOUBdhB6AAjcVgSuvbQrmRsd1YrA3EqkIeuGc3O9vZoZlrb7RaEEOR5/g5EIcsyJGkGyjgIZcpPVaw5+zufUor1eo1WfUkIgaIo3kEUHH5UwA136Iw9DMyN9utYfdbkHPOllAjDEK1UvVoHOOcNCqFQqkdKPIQlrMcXtMe+IgzgRq8qJvTlQkgwndvcrUVpwr3Chky9xiIIsgJNl2D5CiQLVFwiTik2no0yuEMy74P6BqrwHpymWoT8N6HEUzaEDL7BGnxAFf1AmdwiCAL9L9ONjZfHPiLzAsS9xm4zACfxaUJdOiMQPMeuUmqV5Zzq8zjJECzu8Ly6Rjz5CuZeYLdqK8LtOYUCJZmjiIfYzDva1t/1fw7CCHk4R7W6AVu0IfwblOueKjk5Q8gFKuKAR30szO8olBWphSiKQLnqZLYEQgOJdYVi0cVrcHteYdPtegyU0rLSPuPNWPC6q4kPMrtE6l4hdS6V0p8oziusSfnBL8sS1Rtk+QSZ+vAGn7AefoHT+Yil8RmSJboyeWpsjko5XNfVsCwLcRzDsafwH6aQXM0u3SqoDnOmc6U8WfLRjsdjjEYjdLtdzGYz2LaN+18T5ITqwa5L3eceNuUc4XQ6hWmaMAwDjuPA8zz0el29szXBXt1/CferNJlMtDrf9zVpu90GY+yNjB/2+E/C3ww8Hgfd63kvAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/fe2c997149575215d49b22d7fe8e2270/f816d/3.png&quot; srcSet=&quot;/static/fe2c997149575215d49b22d7fe8e2270/2eb24/3.png 215w,/static/fe2c997149575215d49b22d7fe8e2270/05ed2/3.png 430w,/static/fe2c997149575215d49b22d7fe8e2270/f816d/3.png 461w&quot; sizes=&quot;(max-width: 461px) 100vw, 461px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;reference-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#reference-example&quot; aria-label=&quot;reference example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Reference Example&lt;/h3&gt;&lt;p&gt;Variables containing objects does not contain object, but &lt;strong&gt;reference&lt;/strong&gt; to it (points to it)&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj2 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// 10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;obj2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// 10&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;const obj = { x:1 }&lt;/code&gt; creates a new object in the &lt;strong&gt;heap&lt;/strong&gt;, but we have a pointer in stack which stores teh reference(address) to the created element. So the obj contains the pointer, not the actual copy unlike primitive types.&lt;/p&gt;&lt;p&gt;&lt;code&gt;const obj2&lt;/code&gt; that points to &lt;code&gt;obj&lt;/code&gt; has its own pointer, but it will point to the same object that was previously created in the heap.&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:491px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:75.34883720930233%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1klEQVQ4y42UW2+bQBCF/f//TB/6FKlSq/SlUlObqI7BxQ4QjG2W6+7CAqnU0xkcUOzipA+fZjQ7nD17YyaEgJQSRVGgLMsz8rxARkilUZSS8nyyj2usEUURZlwwxqCu6zMaU8GPDdb7Ft/tAx4CBff4jCTXMHX1b3/TgM3NWJ0LVVWdqEncdNTQwos7OPvfuP2xgeWmcMUfJGWDtnvue+q6IU7fsak4ji8EScyoA6RYQSZr6NRBVe5o3PRLk/EGZfgTwrOgoiWq7Ala128J0uxyg8T7BOF/gYxuUecO0izHMRZQu3sk9mf48xuozVdURwciyfrvJwXHWGnKNeV6nL1pO3IcoAjvoY8rihZ0FiJJs37Z0w4H0RfGnIQN7Wnm3SG4+4hwcYPttw8od0tyX1wXPDucSRRqXfSYqoRWEkmS/MeSX0VDB9KSO8aYhk6/6yM75vF3BYechUpV4JdwYHlzWP4Ca9q73T5EQZc9zzOkadrfvXcdnvKT4Fa4WD0tiQdsYxeHeD++DkYpdf3avBbkBtu2sZgvety1i8ftI4IgGF/WEK/fwwt4dkkbz444H5jqHQX5UfM75MIlXJ9iqrdt2/6AZvyHGDaXC1O8NTaMs4bv+/gLTwZx1NLNO0wAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/f200754e3936df9a2b943b67ce366384/13566/4.png&quot; srcSet=&quot;/static/f200754e3936df9a2b943b67ce366384/2eb24/4.png 215w,/static/f200754e3936df9a2b943b67ce366384/05ed2/4.png 430w,/static/f200754e3936df9a2b943b67ce366384/13566/4.png 491w&quot; sizes=&quot;(max-width: 491px) 100vw, 491px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:491px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:75.34883720930233%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAACLElEQVQ4y31UXW+bQBD0//8vfepDpLRSo6jKSxPH1HFiQvyBMdjHAffFge1Wne5iu0oaxw+jg73ZYW5vl16e5zDGQCkFrfUbVJVCSTDWQWlDz9VJHsdYI01T9DjQNA2892/QNjXmokGYbfDjaYVRbBGtd5CVQ+Pr9/y2BZvrsToH6rrew5N4syXCBjOxxTj7heu7FwyiAlH+B1K32Gx3Hcf7lrDPY1NCiP8ESayxGUz+CJ2P4Yoxap1Q3NORNYx4gU6GyGcD2PQBdbmAdf6cYIvWTCHnV5Dxd5jsBl5FXS1zWcAuA8inb4jvL2Gia9RiDFlUncszDtewckwOQ7jyGU6nVHjTXYqTMxgSrZIALhvCyBirtejyTwvWLXZuinz6FcvnL1DJFZpqTA41BHdDMkAaXGJye4GCnHoRYhYncNZ2l/JOcL86+Np2qGuzf2cHlODKGDZ7gKf6mnRI5UiRLKnmRp8W/Cd6gOcScF2bFtvdb6jZHRa3n7HoXyC6+QS3esQyW8Nofc7hoQ1ITFuFZ/GEwayPwfwe4WqI5XICVQqoYo2ykIhjcn3+yEenDZRRmIgIo8UDHgkTaptsvaJLsjQdugMPxodt88YhEcIwRDD4SQjwEk0wnUw7R8fJ4pXxcR8e4JzrjhAEAfr3fYxGo06ceTyzr7mvDXSCTODk49eO4FhZliiKgtpm/1PYbDYnuQzek1Kix38ITuLB5sAR/M6CR5zivOby/nw+x1/wrGsMxUv4owAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/babc1c1919b5430d6ce2b93d705fa34e/13566/5.png&quot; srcSet=&quot;/static/babc1c1919b5430d6ce2b93d705fa34e/2eb24/5.png 215w,/static/babc1c1919b5430d6ce2b93d705fa34e/05ed2/5.png 430w,/static/babc1c1919b5430d6ce2b93d705fa34e/13566/5.png 491w&quot; sizes=&quot;(max-width: 491px) 100vw, 491px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;
&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:491px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:75.34883720930233%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAACR0lEQVQ4y32UW2/aQBCF+f//pU99iJRWahRVecilYK6+YIzxBew19q7XaztEzenskkShSXg4wh5mPs7OzDLI8xxCCFRVBc75icqywp4kaomKC3ouP83TMc1IkgQDHWjbFkqpE3Vtg3XWwkl73C22mIU1vN0BrJRoVfMxv+ugzQ00XQeapjlKEbx9pIQeQfYIO33C9cMSI6+Alz+D8Q7948HkKNWRjnXaVJZl/wEJ1tYpRD4Hz23IwkbDI4orOjKHyJbg0QR5MEKdTNHsN6ilOgfs0IkV2PoKLPwNkd5AVZ7pZc4K1LEFtviFcHgJ4V2jyWywojQuzzjcoWY2OXQg9y4kT6jxwgxFsgCCoGVkQaYTCBZiu8tM/efApsNBrpCvfiJ2f6CKrtCWNjnkyPQ2RCMk1iX8+wsU5FRlDoIwgqxrM5QPwOOnhGpqo6YRx3fjoCPHIep0CkX9FcmE2pEgiqnngn8OfIO+SOkWUF97mvjT019UwQM299+x+XMB7+Yb5HaOON1BcH7O4csaEIzXFZxsgXvvFnfuLZztBHHso9pnqIod9gVDGJLr80d+ddqiEhWWmYvxyiKN4NPapLstDamm28GN9MX4cm1OHFKCbduwhhaskQXf843W6zV9p95WRevrPXyRlNIcYTabYTwZG7C/8nE4HExcF/d9f1LzBtSX+jXpvXTBdDrFfD5HEAQGulwu4bquKdxsNgb0/gcYYxjof4iiKMzF1gEt/axji8UCjuPQIGIDG4/HGA6HiKLIvGvw+3zdjn+0Nmd34jzQfQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/5aed729e1e022c92eb4fadcb4822a5bd/13566/6.png&quot; srcSet=&quot;/static/5aed729e1e022c92eb4fadcb4822a5bd/2eb24/6.png 215w,/static/5aed729e1e022c92eb4fadcb4822a5bd/05ed2/6.png 430w,/static/5aed729e1e022c92eb4fadcb4822a5bd/13566/6.png 491w&quot; sizes=&quot;(max-width: 491px) 100vw, 491px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;more-example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#more-example&quot; aria-label=&quot;more example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;More Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;someStr&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  a &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someStr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;B&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// i doesn&amp;#x27;t change; when arg is passed, it creates a simple copy, so it won&amp;#x27;t change the value of i&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// someStr changes b/c the object doesn&amp;#x27;t get passed, but a reference pointer&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;someStr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;copying-values-of-reference-data-type&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#copying-values-of-reference-data-type&quot; aria-label=&quot;copying values of reference data type permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Copying values of reference data type&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Copying elements of objects&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;A&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj2 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ES5&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; obj3 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;obj &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;             &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ES6&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Copying elements of array&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr2 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ES5&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr3 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ES6&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;potential-issue-deep-cloning&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#potential-issue-deep-cloning&quot; aria-label=&quot;potential issue deep cloning permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Potential issue (Deep Cloning)&lt;/h3&gt;&lt;p&gt;Although &lt;code&gt;person2&lt;/code&gt; copied values from &lt;code&gt;person&lt;/code&gt;, changing the value of &lt;code&gt;personality[0]&lt;/code&gt; affects the &lt;code&gt;person2&lt;/code&gt; because the values were not &lt;strong&gt;deeply copied&lt;/strong&gt; or &lt;strong&gt;deeply cloned&lt;/strong&gt;. i.e. shallow cloned.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Ellis&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;personality&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;cool&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;nice&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person2 &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;person &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;personality&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;not cool&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;person2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To execute deep cloning or array/object, use of library like &lt;a href=&quot;https://lodash.com/&quot;&gt;LoDash&lt;/a&gt; is preferred.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[JS]: class Inheritance Example]]></title><description><![CDATA[Example 1 Output Example 2 Output ES7 Equivalent]]></description><link>https://ellismin.com/2019/09/js-class/</link><guid isPermaLink="false">https://ellismin.com/2019/09/js-class/</guid><pubDate>Thu, 26 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;example-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-1&quot; aria-label=&quot;example 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 1&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Car&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;brand&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; brand&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;printName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Car&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;brand&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; model&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;brand&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; model&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;printModel&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; myCar &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Honda&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Accord&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;myCar&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;printName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;myCar&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;printModel&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;output&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#output&quot; aria-label=&quot;output permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Output&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Honda&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Accord&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;example-2&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-2&quot; aria-label=&quot;example 2 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example 2&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Car&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Honda&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;printName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Car&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Accord&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Toyota&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;printModel&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; myCar &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;myCar&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;printName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;myCar&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;printModel&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;output-1&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#output-1&quot; aria-label=&quot;output 1 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Output&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Toyota&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Accord&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;es7-equivalent&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#es7-equivalent&quot; aria-label=&quot;es7 equivalent permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ES7 Equivalent&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Car&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Honda&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;printName&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token class-name&quot;&gt;Car&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  model &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Accord&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  name &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Toyota&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line gatsby-highlight-code-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;printModel&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// ...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Scraping]: Basics]]></title><description><![CDATA[Extracting source elements with Node.js & Puppeteer]]></description><link>https://ellismin.com/2019/09/puppeteer-2/</link><guid isPermaLink="false">https://ellismin.com/2019/09/puppeteer-2/</guid><pubDate>Thu, 26 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;Web scraping&lt;/strong&gt; allows to extract large amounts of data from websites. I&amp;#x27;ll use my &lt;a href=&quot;https://ellismin.github.io/&quot;&gt;github page&lt;/a&gt; as an example. We&amp;#x27;ll use &lt;strong&gt;Node.js&lt;/strong&gt; with &lt;strong&gt;Puppeteer&lt;/strong&gt; for web scrapping.
&lt;a href=&quot;/2019/09/puppeteer-1/#1-install-nodejs&quot;&gt;Install Node.js &amp;amp; Puppeteer&lt;/a&gt;&lt;/p&gt;&lt;h2 id=&quot;1-decide-which-information-to-extract&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-decide-which-information-to-extract&quot; aria-label=&quot;1 decide which information to extract permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Decide which information to extract&lt;/h2&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:68.83720930232559%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAACmklEQVQ4y52T3UtTYRzHz1/STf9DQd0E2V3QRXTVRRF00QsFIZRmoZQk1WbQjVREaBpWYmW21JwvO3L25nSbbm5z0+lez16c29ycbvv0bFYERZA/+PA9nN9zvuc5z/d3pFwuRzq9QU3/VdVqhWKxWL+uabVa/dX7eb+0s4O0EooSWI8QjMSJpTLE05uoG1kSNTI5kpt50tkt4qK3GorgD64TjiUIxVSMZguK0YRn2Y9isuD2+JAmTFamrXPINjszcw4U+yIm5xIWlxebx49jeZWFQBDr4hKTRgu6iSl63r7jVd8b9LKMbDbT9eI5h48cpflOC5JtzojdYcW5OI/L4xRvc7O84iWw5mctvEokto7H5xI7MTCuH0H3dQid7hP+wBKZTFwcV5RQyMeJhmMMf+5HWlsYJeTWE/ZOE/UrqEELqdAcmaiDrOoin/SQDNsJuKYxTQ3gNOsopL2UNv0Ukm7y6gLFpJPTpxpQxl4jyQNPMQ914Rh9iVvfjXeqF7/cT9D4noj1AxHLIDHbRwKGPuxfnhG1DpJyDhOfFT2TWDPTS8jQw8njhxjvbkc6c+4SZy9e4/zlG1y42siVxhau37xL4+02mlvbaRG03ntAW3sH9zse8fCxto5G24lGo6VTq+FJp4aDBw/Q1HRLhCIb+TYpU9Nxg1LXacVcxyBCMBityCK4GfMsRhGeIjDZ5rHOO/awO+va09ONIgKS7DYL2U0xLvE4qVTqx8xV2W9JYyOjqKqKmkiQFIa7u7tkxZBvb29TqVQol8uCyh6VPSp/ofZcba1Uc93dKVEWU/7n31H9b6RYaoNwMk1E6MZWkbQgt12que3P0BOOY18N4xD4ogmWVWGeye1/h8WtLUqFAvlslqo4g98/dz/1HWdF6qEzXQqVAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;1&quot; title=&quot;1&quot; src=&quot;/static/7c5272c1824c6c4ec933efc49ea8aebd/914ae/1.png&quot; srcSet=&quot;/static/7c5272c1824c6c4ec933efc49ea8aebd/2eb24/1.png 215w,/static/7c5272c1824c6c4ec933efc49ea8aebd/05ed2/1.png 430w,/static/7c5272c1824c6c4ec933efc49ea8aebd/914ae/1.png 860w,/static/7c5272c1824c6c4ec933efc49ea8aebd/46115/1.png 1290w,/static/7c5272c1824c6c4ec933efc49ea8aebd/8bb81/1.png 1602w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;As an example, I&amp;#x27;ll try to extract the &lt;strong&gt;inner HTML texts&lt;/strong&gt; in the header tab: &lt;em&gt;About&lt;/em&gt;, &lt;em&gt;Posts&lt;/em&gt;, &lt;em&gt;SQL&lt;/em&gt;, &lt;em&gt;Spring&lt;/em&gt;, &lt;em&gt;Swift&lt;/em&gt;&lt;/p&gt;&lt;h2 id=&quot;2-inspect-the-elements-on-page&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-inspect-the-elements-on-page&quot; aria-label=&quot;2 inspect the elements on page permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Inspect the elements on page&lt;/h2&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:46.04651162790698%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAABYlAAAWJQFJUiTwAAACOklEQVQoz52S20uTARjGv7/Mi267iKSLEFQSKjMtzUwcO3xrm1N2UpNFHucszdB18ARh6Q46bOh0zanTYZs7OWdONiMx/fW17rvogR8PLy/vxfvwCIVCgcNsltzJCf+S3+9naMiO2+PB41nE6XQxPT3N0pK3uP91cVF0YTeWYCeaYC+eJpo6JJbOsn9wRDzzncThcZHc6Rmzc/PIFEp0+jbaDUYJA80yWXH+tOBkwe3BKSHMe5dx+VZYXPHj9QdYDmzgC26xuhlmPRwhGNljK7rPxOQUClHFU60WlVpEq9ehFJUYTAZulpVx/UYp9hE7QmBtieDXL4RCq2yHA+xGQuxFt4nFIyRT30gdRAnvBBkbG0apbKFVJ6LTqVDIm3jyuI6RV320taqQyxrIn0QRkuvvSW/MkNn6yNHOZ3J7bvIxLz+SPn4e+CXWOMus4Z7qRy+rwaisxSzWYhHr0DRW4ujT0N3WRKvsLpfpRYQek4itS8ebXgMOm4XJ4S5mR63MjffgetePy9GLb2qAQauJerWZh2oLd+QmqhUmyhu1aNuNNFSVcr/iGoGZfoTbj5RUP1bxQKajTqJJbaRFa0au70A0PENt7Ka98zn1mi5Km19wtdFKSU0HV2o7KbnXQZXGRnllBRW3qhgcHZdeTqVIpdPE9uNFstkjcrncX6QqHR/nKJyeSjkHeP3Sxqh9gJ5uC33WTsnNzH5wkMlkpLssfyooTL6dYHszRDyRJJFIcHl5QT6f5/z8nP/Rb0PaPVoyWSIwAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;2&quot; title=&quot;2&quot; src=&quot;/static/dc960ff0747c359c4bda24e6347c06a7/914ae/2.png&quot; srcSet=&quot;/static/dc960ff0747c359c4bda24e6347c06a7/2eb24/2.png 215w,/static/dc960ff0747c359c4bda24e6347c06a7/05ed2/2.png 430w,/static/dc960ff0747c359c4bda24e6347c06a7/914ae/2.png 860w,/static/dc960ff0747c359c4bda24e6347c06a7/46115/2.png 1290w,/static/dc960ff0747c359c4bda24e6347c06a7/a5a94/2.png 1657w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:860px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:37.674418604651166%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAABYlAAAWJQFJUiTwAAACFklEQVQoz12S20tTcRzAzz/Qwyo9novneNlx29m8pFkzqZf+kwjB6CY6t4whUlTiJcWhMi/D2y5nzbksKA0iDYWB1ENESvUQKAj5nA/Bp7MFBj184Pf04fv9fb7C/MIilmUVSaVSLGdXePfhG19/HHL084iDgwP29/f5dXxMPB6n2uXB9HhoqPNRX99AY10tLsOJrutomobweGiEwdEIw5GJItHYPJv5z7zd+sirNxt82t0jkc4wNDJKuLeX6ho3l/wXOGeLTJ+Nx41ui8rKypAkCWF8rJ/J8SGmo6PMTEdYWpgiv73G1uZLvu/t8Pv4kO2NFwz33yc+F6Gq2qCpqQmfz4fXNDG9PjR7OkmWUVUVIXTnGuHONvqCN3hw7yZPH3azbk2Qf73El+3n7L7PkJt9wqNQG9H+ELrhprXFz5VGLw21XjwuA1WREUtLkOwphevtt2m/1cHdziAdXUGCPWGis3PMLyWZW4yTSKUZn5hkYHCAULiP07oH18Wr+P2tnG9uwWy+jOz0ckauoFStQojFYsXPTqctMpkM2eyyTfYfKyt2qCzra2uEeno45ThLuWFiGAbuSh29yomoaIiSjKTYKyeKsjTJZPKktmXXLmL9JZlIkMvlCAS6cDgcVDhrqNDKqVQlNFVGkQtIKIqCMDY1Y68X55ktPRH+R+GcVldX6Q4EcJSIKOV2VVEslhUL2O8Chcp/AHmBct4r24xNAAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;3&quot; title=&quot;3&quot; src=&quot;/static/cf2d8b6b696131985acc43622b7c0b28/914ae/3.png&quot; srcSet=&quot;/static/cf2d8b6b696131985acc43622b7c0b28/2eb24/3.png 215w,/static/cf2d8b6b696131985acc43622b7c0b28/05ed2/3.png 430w,/static/cf2d8b6b696131985acc43622b7c0b28/914ae/3.png 860w,/static/cf2d8b6b696131985acc43622b7c0b28/46115/3.png 1290w,/static/cf2d8b6b696131985acc43622b7c0b28/6c86f/3.png 1720w,/static/cf2d8b6b696131985acc43622b7c0b28/98427/3.png 2689w&quot; sizes=&quot;(max-width: 860px) 100vw, 860px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Right click the element to &lt;strong&gt;inspect elements&lt;/strong&gt; or open &lt;strong&gt;debugging&lt;/strong&gt; console by pressing &lt;strong&gt;F12&lt;/strong&gt; button. Then, you&amp;#x27;ll notice that each navigation item is placed in &lt;strong&gt;li&lt;/strong&gt; tag with a class name &lt;strong&gt;masthead__menu-item&lt;/strong&gt;&lt;/p&gt;&lt;h2 id=&quot;3-verify--select-items&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-verify--select-items&quot; aria-label=&quot;3 verify  select items permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Verify &amp;amp; Select items&lt;/h2&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:834px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:71.16279069767442%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAACNklEQVQ4y61TyXbbMAzUX+TlaMmWbG0WtZEmJdGSFzlNXvv/XzMF4CSvh97awzxwAQeDgRRcLhcMwwDnHLquA+/XdUVRFHh5eUGe53h9fcXxeMT9fof3Hn3fQ2sNpRTqupZ3fHY6nRBwEpON4yiRDzmJwaRMVFUVpmmSHF4zERNz8WVZ5I4L3G43BHxgjIElIo5crWm4aivrL/ADVtE0jYD3nM+RwTmi0FpHLY+Y/BnzQhWvK7rekJIaqm5ITUNqKZJiJmrpYdu238R/grsKmNmRh/O8YJyIeOwwOAWrS5guh9EF2opRip+H/R5Zlsn6bwiUqoT98XiQUoezNxgsKdEN7GjhpoHa4XZJdaMJPZL9AWEYIoq2EsNw8xlDBMeyQFoeYWea4PUN8/oTZphh/B16uMCeaeK9g1ve4G8fmK7vdH5Gb72AC2zjBNvtVhAUWYpon8qjimEoSY9oKblsaeKnEZlqoShWZoJiEjPSfhLUZkBMine73ZNQkTc8Pf4MtO5g+gOsSSWaPoXuM6gyQ5/HGKsDvEplPRz3FBO4KhVPmYxJqeUSddNifXuHp8HMy4yOPwM3wU4z3PmKWjvyc8HJeQz+grIoUfAQshzp4SBkURQJgoxaTvICvb+JR379RR7RxK8f0CP9RcsDGQ3DXX7I3UAeGsq180P87cmKcLPB9rtlMjVOEpG728XYxTGSZC+Rz+LPKHe8p9xn/jOX778GIoT8az0/gei/ICjJww1L/qPKv+A3m6650xc7qHYAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;4&quot; title=&quot;4&quot; src=&quot;/static/086fdf9d4a429b0a414b689174de51b7/5d72a/4.png&quot; srcSet=&quot;/static/086fdf9d4a429b0a414b689174de51b7/2eb24/4.png 215w,/static/086fdf9d4a429b0a414b689174de51b7/05ed2/4.png 430w,/static/086fdf9d4a429b0a414b689174de51b7/5d72a/4.png 834w&quot; sizes=&quot;(max-width: 834px) 100vw, 834px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;verify&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#verify&quot; aria-label=&quot;verify permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Verify&lt;/h3&gt;&lt;p&gt;Move to console and select the specified elements&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;document.querySelectAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;li.masthead__menu-item&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To find certain elements on current page. Here, we find five elements within &lt;strong&gt;li&lt;/strong&gt; tag with class name &lt;strong&gt;masthead__menu-item&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:814px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:133.48837209302326%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAbCAYAAAB836/YAAAACXBIWXMAABYlAAAWJQFJUiTwAAADlUlEQVRIx5VV2XIbOQz0R8Rz8+bcl6QktVWbSv7/r3oblEa2FDu7+wCRI5EtoLuBedFaY11X7PuOoY9YRoVp0JhHndZxMAiWq22wB4VT1BhMjclWXCssroazBkVRoixLvFT8iF2HdT9jWjaM0wobOvhhQ2R08xkm9OiWC8K4oZ1P0Naj0Q61tqiUQZbnyBl1XeOlKHI0xiOOcnlHv5zS2o0rAWeuCxoX0E4beoZ83/K7dlgQ+wkDz47zX8iy1ytglmcwjZTVwvmeJRJUMhkm+HaA9W1aGy1lFSiriqVVqbwj6lq9z7DAK9FNZbCZDbs5YTUrNA8VZZ5AXl+/MIPs08jz7A1QNkVZwCuPUU+YzYLFkkvDvVvgjIMx5iGstWl1jr9pD61sAn4AjDomwEUAmWG0HYY4IoRIKjys8/AhoHYROnbQRqNtWwIaVKQh4bCaVLLw6GqXSt3dGb3pMKvIrBVMXUFTOMM/VTxryZmsmiByV0SV+A3QVhYngm2OKusWCwGXJqKlYL6i1wSMlzxXRwBdXAESUF68AR4lO+XI35xAZ7vC24hIhQ05VDS/qFzxuVAaJb1XsfS6UXcPPgCK9EGHqyDCnyFvwTE8jLNJBEsBYtujlpJZrqobNGIZgtRlcSv/yFDKaWwCXKlwoECB7TQweqoZmGFHPmcCnJoaPXmNvBOlyySorvizINbLwYOqdMru7C5XHklBrwICL1jyJRxqCT5niff8IR5EOQDFNpOekwet7shtky7nApDOXYGK2+WP4g6oCXiUPNgRikYvi6u/8ruab0D5E+iHGV4Bd5zthdYZ4HVP4guYXHx47dv8k+weVM7JUSBfmz1xvnGacFBMcaIwHi3VHalypDj5H0p9ypCd0nhm1ZM7m1qpOKbKsX/XXh8B/1ayTBsxtXDYKo4sKZlcHr//CezDDAVwp102cigx25mA9oG3/1TysfHkcNBjylBa0FiZLOE+6/4XoGQhvTyoMZl7lnloF3bJCM13R/GOv0/jmUNbW6xuS31sbhxWtzfZcSF/6o5POyW7cdhybEXT0pMqWemLHM6yuygyCIz0/S1ceX12/NPq1lEJUN7N4rsf00/8nH7hMn3Ht77D3zGgj8zYcOSLFxk9p0/HteM60aMt9yMnurv5NAGK7zzfDZf4Fd/a71jCisDDnp5UnHnyrpConqJ8v79N8HvJqlRJlF4NadXkVKuOHDb3kv8tBOsfx5fVU6ekkkgAAAAASUVORK5CYII=&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;5&quot; title=&quot;5&quot; src=&quot;/static/d30f86424071fb011ac4cc1d9a47b655/a4262/5.png&quot; srcSet=&quot;/static/d30f86424071fb011ac4cc1d9a47b655/2eb24/5.png 215w,/static/d30f86424071fb011ac4cc1d9a47b655/05ed2/5.png 430w,/static/d30f86424071fb011ac4cc1d9a47b655/a4262/5.png 814w&quot; sizes=&quot;(max-width: 814px) 100vw, 814px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Expand the list to see their values. You&amp;#x27;ll notice each &lt;strong&gt;li.masthead__menu-item componenet&lt;/strong&gt; has its &lt;strong&gt;&lt;em&gt;innerText&lt;/em&gt;&lt;/strong&gt; values that we were interested in.&lt;/p&gt;&lt;h3 id=&quot;select-innerhtml&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#select-innerhtml&quot; aria-label=&quot;select innerhtml permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Select innerHTML&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:830px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:69.30232558139535%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAACbUlEQVQ4y42TWXPaUAyFnYUAaYamSQCzGON9ucYYDAYcyNYmmen//z9fZRIyfeg0eTgj6Ug6vlfy1UzLQsUhaZoSqwCV2ESJR6hcokhyyiYMfJTvkIUW89giCcZMAxtzZKD3+uj9Hr1+n95ggBb1eiS9DulwwHTcQ5kDAtPCM0Y4ehu7e00wHOJLg6dfEw0k7l/hSq7famHcXDNqtzGuruh//442v7ggaTTZSLC8aJE1zyn3/jdS4cPaGYamMRIE4pvaEc7xKdbRMe7JCQsRW+g6dqPBQGo087yJJSKxfC29bLFqdyhubpj9uCSTeCKwm2dY9Rr+eR2n2cCpN7DO6njNChI36pi1GoPTU7SJirlb5Tzcbig3iudfG+5/vrJ7/k2xXXNXRtzfZbwI//SwZLWesF1GvErtY5GySUOWMutS7EhGo0VRRJmnrJcLyizhaZEwmeYslxtWeUEqi9plKU/bLbtixXYasc1j1vOY24nU+j5F+YrvhwwPglGsKOYb7sR/8QPSULZtjZk5Nr7rMXEcAvkbQsHMcVGOhy/IhFe+R148vAvKloMgwK4Kk5xtIteQEfjCWdJouS6ONO3tOyzXwRY4rvPmS35sGrjiD4cGWhiGuNI8nyzYKcVOTqlEsGp2vwxvb/dXDuR61SkqwVJO9yjxLI6xbHvPV/hM8FDzJlhdWWY1j3PW8YJczfBkHp7nUeUODZ/hQ7BaStU4VVMRWzIJp2RZRlmW7HY7kiTZF1cf+B982bZhyAy9MME0TcbjMea4sm+ouNFotOctWdrB/guH3KB6y9WqO50Oelen2+1+QJfnVOFv7iv4A+ZEixERxKf+AAAAAElFTkSuQmCC&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;6&quot; title=&quot;6&quot; src=&quot;/static/14edf8bc5c267ff84fa5a7d4e04f291c/715a3/6.png&quot; srcSet=&quot;/static/14edf8bc5c267ff84fa5a7d4e04f291c/2eb24/6.png 215w,/static/14edf8bc5c267ff84fa5a7d4e04f291c/05ed2/6.png 430w,/static/14edf8bc5c267ff84fa5a7d4e04f291c/715a3/6.png 830w&quot; sizes=&quot;(max-width: 830px) 100vw, 830px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;Get a copied array of innerHTML texts from navbar items&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Array.from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;document.querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;li.masthead__menu-item&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;.map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;subpages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; subpages.innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that &lt;strong&gt;NodeList&lt;/strong&gt; needs to be converted into &lt;strong&gt;Array&lt;/strong&gt;. Otherwise, it will trigger an error&lt;/p&gt;&lt;h2 id=&quot;4-use-nodejs--puppeteer-for-scraping&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-use-nodejs--puppeteer-for-scraping&quot; aria-label=&quot;4 use nodejs  puppeteer for scraping permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Use Node.js &amp;amp; Puppeteer for scraping&lt;/h2&gt;&lt;p&gt;If not previously done, &lt;a href=&quot;/2019/09/puppeteer-1/#1-install-nodejs&quot;&gt;install Node.js &amp;amp; Puppeteer&lt;/a&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;puppeteer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; navItems &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;li.masthead__menu-item&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;subpages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; subpages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;navItems&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Insert the query from above step into a js file. Then test it with&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; scraper.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; scraper.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;About&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Posts&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;SQL&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Spring&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Swift&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;output-result-array-into-file&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#output-result-array-into-file&quot; aria-label=&quot;output result array into file permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Output result array into file&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; navItems &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;li.masthead__menu-item&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;subpages&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; subpages&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;writeFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;navItems&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;array.txt&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Write array into file&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;writeFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; fileName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; strToBeWritten &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex regex-source language-regex&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token regex regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex regex-flags&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;\r\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fs &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;fs&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  fs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;writeFile&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fileName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; strToBeWritten&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;The file was saved!&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can output the array into file with above function.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; strToBeWritten &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token regex regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex regex-source language-regex&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token regex regex-delimiter&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;token regex regex-flags&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;\r\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;arr.toString&lt;/em&gt;&lt;/strong&gt; has array elements with &amp;quot;,&amp;quot; in them. With above line of code, file stores each element in array in each line of code. &lt;strong&gt;&lt;em&gt;/,/g&lt;/em&gt;&lt;/strong&gt; replaces all occurrences of &amp;quot;,&amp;quot; to new line&lt;/p&gt;&lt;p&gt;Output in &lt;strong&gt;&lt;em&gt;array.txt&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cat&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; array.txt&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;About&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Posts&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;SQL&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Spring&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We have achieved our main goal here. Continue reading if you want to manipulate with stored data&lt;/p&gt;&lt;h2 id=&quot;downloading-images-in-page-as-file-request-module&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#downloading-images-in-page-as-file-request-module&quot; aria-label=&quot;downloading images in page as file request module permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Downloading images in page as file (+request module)&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;document.querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;p&amp;gt;img&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Above command in console selects all images on &lt;strong&gt;this particular post page&lt;/strong&gt;. Now, you can modify the &lt;strong&gt;&lt;em&gt;navItems&lt;/em&gt;&lt;/strong&gt; array to &lt;strong&gt;&lt;em&gt;images&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&amp;quot;&amp;gt;&amp;quot;&lt;/strong&gt; sign specfies all &lt;strong&gt;&lt;em&gt;img&lt;/em&gt;&lt;/strong&gt; tags that is &lt;strong&gt;right under&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;p&lt;/em&gt;&lt;/strong&gt; tag&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io/webscraping/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Get elements&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; images &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;p&amp;gt;img&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;imgs&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; scraper.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://ellismin.github.io/images/webscrape/1.png&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://ellismin.github.io/images/webscrape/2.png&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://ellismin.github.io/images/webscrape/3.png&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://ellismin.github.io/images/webscrape/4.png&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://ellismin.github.io/images/webscrape/5.png&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;https://ellismin.github.io/images/webscrape/6.png&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We have an array of image sources. Now, we can download them.&lt;/p&gt;&lt;h3 id=&quot;request-module&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#request-module&quot; aria-label=&quot;request module permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Request module&lt;/h3&gt;&lt;p&gt;Downloading images with image url we&amp;#x27;ve extracted is a lot easier with &lt;a href=&quot;https://github.com/request/request&quot; target=&quot;_blank&quot;&gt;request module package&lt;/a&gt;. To install request module:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ npm i request&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io/webscraping/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; images &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;p&amp;gt;img&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;imgs&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;downloadImage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;images&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;imgPrefix&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;downloadImage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; imgPrefix&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fs &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;fs&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    request &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;request&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;download&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; filename&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    request&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token parameter punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt; body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;pipe&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createWriteStream&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;close&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; callback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// download images with urls in arr&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgName &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgPrefix &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;download&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; imgName&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;image created!&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;scraping-recent-posts&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#scraping-recent-posts&quot; aria-label=&quot;scraping recent posts permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Scraping recent posts&lt;/h2&gt;&lt;p&gt;Let&amp;#x27;s now try scrapping a multiple items and store them into json format. Try scrapping titles and excerpts of recent posts from &lt;a href=&quot;https://ellismin.github.io&quot; target=&quot;_blank&quot;&gt;main page&lt;/a&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;article&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelecto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;article h2.archive__item-title&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;article p.archive__item-excerpt&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;First line selects &lt;strong&gt;all articles&lt;/strong&gt; which each of them contain a &lt;strong&gt;title&lt;/strong&gt; and &lt;strong&gt;excerpt&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;Second line selects &lt;strong&gt;a title&lt;/strong&gt; within an article&lt;/li&gt;&lt;li&gt;Third line selects &lt;strong&gt;an excerpt&lt;/strong&gt; within an article&lt;/li&gt;&lt;/ol&gt;&lt;h3 id=&quot;scraperjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#scraperjs&quot; aria-label=&quot;scraperjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;scraper.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; posts &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;evaluate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token known-class-name class-name&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;article&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;h2.archive__item-title&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;excerpt&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; post&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;p.archive__item-excerpt&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token console class-name&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;posts&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; scraper.js&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Web Scraping&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    excerpt: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Extracting source elements with Node.js &amp;amp; Puppeteer&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Aggregate Functions&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;, excerpt: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;COUNT • GROUP BY&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Web Scraping Prerequisites&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    excerpt: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Use Puppeteer for web scraping&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Table of Contents&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    excerpt: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Dynamically generate table of contents with JavaScript&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Refining Selections&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    excerpt: &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;DISTINCT • ORDERBY • LIMIT • LIKE&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[JS]: import/export snippets]]></title><description><![CDATA[Export Default Export person.js Named Export util.js Import alias *]]></description><link>https://ellismin.com/2019/09/js-import-export/</link><guid isPermaLink="false">https://ellismin.com/2019/09/js-import-export/</guid><pubDate>Thu, 26 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;export&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#export&quot; aria-label=&quot;export permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Export&lt;/h2&gt;&lt;h3 id=&quot;default-export&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#default-export&quot; aria-label=&quot;default export permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Default Export&lt;/h3&gt;&lt;p&gt;&lt;em&gt;person.js&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Ellis&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; person&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;named-export&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#named-export&quot; aria-label=&quot;named export permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Named Export&lt;/h3&gt;&lt;p&gt;&lt;em&gt;util.js&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;func1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;func2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;fun1&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;fun2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token spread operator&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; func1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; func2 &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;import&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#import&quot; aria-label=&quot;import permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Import&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./person.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Can assign any name for named export&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Must use the same name assigned in util.js but can assign alias&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; func1&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; func2 &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./util.js&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;alias&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#alias&quot; aria-label=&quot;alias permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;alias&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; func1 &lt;/span&gt;&lt;span class=&quot;token imports keyword module&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; firstFcn&lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; func2 &lt;/span&gt;&lt;span class=&quot;token imports keyword module&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; secondFcn &lt;/span&gt;&lt;span class=&quot;token imports punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./util.js&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#&quot; aria-label=&quot; permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;*&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Usage: functions.func1 / functions.func2&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token imports keyword module&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token imports&quot;&gt; functions&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword module&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;./util.js&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Aggregate Functions]]></title><description><![CDATA[COUNT • GROUP BY • MIN/MAX • SUM • AVG]]></description><link>https://ellismin.com/2019/09/sql-aggregate-fcn/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-aggregate-fcn/</guid><pubDate>Thu, 26 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;script src=&quot;/js/tableOfContents.js&quot;&gt;&lt;/script&gt;&lt;h2 id=&quot;count&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#count&quot; aria-label=&quot;count permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;COUNT&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| COUNT(*) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|       15 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; uniqueLnames&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; uniqueFullnames&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+--------------+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| COUNT(fname) | uniqueLnames | uniqueFullnames |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+--------------+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           15 |           12 |              14 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+--------------+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; duplicateLnames&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| duplicateLnames |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|               3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%science%&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Show how many majors contain &amp;quot;science&amp;quot;&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| COUNT(*) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;group-by&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#group-by&quot; aria-label=&quot;group by permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;GROUP BY&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;GROUP BY&lt;/em&gt;&lt;/strong&gt; summarizes identical data into single rows. For example, consider an imaginary query and output below. GROUP BY by default can &lt;strong&gt;order the list in ascending order&lt;/strong&gt;, depending on SQL mode.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students_temp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| major               | lname |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer engineering| Smith |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer science    | Min   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Economics           | Min   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting          | Smith |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Communication Art   | Kim   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;result-of-group-by-lname&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#result-of-group-by-lname&quot; aria-label=&quot;result of group by lname permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Result of GROUP BY lname&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students_temp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| major               | lname |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer engineering| Smith |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer science    | Min   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Communication Art   | Kim   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;what-happens-behind-the-scene&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-happens-behind-the-scene&quot; aria-label=&quot;what happens behind the scene permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What happens behind the scene&lt;/h3&gt;&lt;p&gt;Though it isn&amp;#x27;t shown in above output, SQL groups by lname behind the scene&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer engineering| Smith |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting          | Smith |&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer science    | Min   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Economics           | Min   |&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Communication Art   | Kim   |&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since the data is grouped we can do things like &lt;em&gt;how many majors each person has&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students_temp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| lname | COUNT(*) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Min   |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Kim   |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;group-by-fullname&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#group-by-fullname&quot; aria-label=&quot;group by fullname permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Group BY fullname&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | lname    | COUNT(*) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina | Randall  |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     | Johnson  |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    | Lang     |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan      | Joyce    |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave     | Smith    |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    | Miller   |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah | Tucker   |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John     | Johnson  |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont   | Marks    |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena     | Shah     |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary     | Fletcher |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam      | Smith    |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin   | Pema     |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;group-by-with-concat&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#group-by-with-concat&quot; aria-label=&quot;group by with concat permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;GROUP BY with CONCAT&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; has &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; student(s)&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CONCAT(major, &amp;#x27; has &amp;#x27;, COUNT(*), &amp;#x27; student(s)&amp;#x27;) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting has 1 student(s)                     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art has 1 student(s)                            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biochemistry has 1 student(s)                   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology has 2 student(s)                        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Business has 1 student(s)                       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemistry has 1 student(s)                      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science has 2 student(s)               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Economics has 1 student(s)                      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Food Science has 1 student(s)                   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Japanese 10% has 1 student(s)                   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linguistics has 1 student(s)                    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| no_major has 1 student(s)                       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physics has 1 student(s)                        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;min--max&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#min--max&quot; aria-label=&quot;min  max permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MIN / MAX&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;MIN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| MIN(credit) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shows the lowest credit student has&lt;/p&gt;&lt;h3 id=&quot;what-if-you-want-to-show-the-name-with-min-credit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#what-if-you-want-to-show-the-name-with-min-credit&quot; aria-label=&quot;what if you want to show the name with min credit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;What if you want to show the name with MIN credit?&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Method 1 (WHERE)&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;MIN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;MIN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Method 2 (ORDER BY)&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;3&quot;&gt;&lt;li&gt;WRONG&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;MIN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;1st solution is &lt;strong&gt;inefficient&lt;/strong&gt; because it&amp;#x27;s running &lt;strong&gt;two queires&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Method 2&lt;/strong&gt; is preferred&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Correct&lt;/strong&gt; output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name         | credit |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego Miller |      6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Incorrect&lt;/strong&gt; output (3.)&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | MIN(credit) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis |           6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;This creates a wrong output because &lt;strong&gt;&lt;em&gt;MIN(credit)&lt;/em&gt;&lt;/strong&gt; executes &lt;strong&gt;separate from&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;fname&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;minmax--group-by&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#minmax--group-by&quot; aria-label=&quot;minmax  group by permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MIN/MAX &amp;amp; GROUP BY&lt;/h3&gt;&lt;p&gt;Ex) Show the student&amp;#x27;s full name along with their lower credit amount&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;MIN&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fullname         | MIN(credit) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ...              |         ... |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis Min        |          13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ...              |         ... |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We have &lt;strong&gt;two&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;Ellis Min&lt;/em&gt;&lt;/strong&gt; in our data. The above query selects the minimum credit &lt;strong&gt;&lt;em&gt;13&lt;/em&gt;&lt;/strong&gt;, instead of &lt;strong&gt;&lt;em&gt;5555&lt;/em&gt;&lt;/strong&gt;. The other students aren&amp;#x27;t duplicate so they don&amp;#x27;t matter much for this problem&lt;/p&gt;&lt;p&gt;In other words, Ellis Min behind the scene is grouped by like below&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis Min        |        5555 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis Min        |          13 |&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then &lt;strong&gt;&lt;em&gt;MIN(credit)&lt;/em&gt;&lt;/strong&gt; will pick the &lt;strong&gt;lowest&lt;/strong&gt; amount between two&lt;/p&gt;&lt;h2 id=&quot;sum&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#sum&quot; aria-label=&quot;sum permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;SUM&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| SUM(credit) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|        8427 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Adds all credits&lt;/strong&gt; of all students&lt;/p&gt;&lt;h3 id=&quot;sum--group-by&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#sum--group-by&quot; aria-label=&quot;sum  group by permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;SUM &amp;amp; GROUP BY&lt;/h3&gt;&lt;p&gt;Ex) Sum all credits each student have&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name             | SUM(credit) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ...              |         ... |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis Min        |        5568 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ...              |         ... |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+-------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ellis Min now has 5568 credits (5555 + 13)&lt;/p&gt;&lt;h2 id=&quot;avg&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#avg&quot; aria-label=&quot;avg permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;AVG&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| avg(age) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|  21.6000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Find the average of students&amp;#x27; age&lt;/p&gt;&lt;h3 id=&quot;round&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#round&quot; aria-label=&quot;round permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ROUND&lt;/h3&gt;&lt;p&gt;Rounds a number to a specified number of decimal places&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ROUND(AVG(age)) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|              22 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;No rounding&lt;/strong&gt;.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Round to &lt;strong&gt;2 decimal&lt;/strong&gt; place.&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ROUND(AVG(age), -1) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|                  20 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Round to &lt;strong&gt;-1 decimal&lt;/strong&gt; places.&lt;/p&gt;&lt;h3 id=&quot;avg--group-by&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#avg--group-by&quot; aria-label=&quot;avg  group by permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;AVG &amp;amp; GROUP BY&lt;/h3&gt;&lt;p&gt;Try find out average of age by the same major &amp;amp; round it up to 1 decimal&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ROUND&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;avg age by major&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;GROUP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| major            | avg age by major |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting       |             22.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art              |             26.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biochemistry     |             18.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology          |             22.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Business         |             20.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemistry        |             23.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science |             21.5 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Economics        |             18.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Food Science     |             31.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Japanese 10%     |             16.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linguistics      |             19.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| no_major         |             27.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physics          |             17.0 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Duplicate majors are grouped together and shows the relevant average age&lt;/p&gt;</content:encoded></item><item><title><![CDATA[[Scraping]: Learn how to scrape the web with Puppeteer]]></title><description><![CDATA[Use Puppeteer for web scraping]]></description><link>https://ellismin.com/2019/09/puppeteer-1/</link><guid isPermaLink="false">https://ellismin.com/2019/09/puppeteer-1/</guid><pubDate>Thu, 26 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;script src=&quot;/js/tableOfContents.js&quot;&gt;&lt;/script&gt;&lt;p&gt;&lt;strong&gt;Puppeteer&lt;/strong&gt; is a Node.js library maintained by Chrome&amp;#x27;s dev team from Google, also known as &lt;strong&gt;headless browser&lt;/strong&gt;. It can be used to generate screenshots, PDFs of pages, automate form submission, and many more.&lt;/p&gt;&lt;h2 id=&quot;1-install-nodejs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-install-nodejs&quot; aria-label=&quot;1 install nodejs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Install Node.js&lt;/h2&gt;&lt;p&gt;If not previously installed, install &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;Node.js&lt;/a&gt;&lt;/p&gt;&lt;h2 id=&quot;2-install-puppeteer&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-install-puppeteer&quot; aria-label=&quot;2 install puppeteer permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Install Puppeteer&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;npm&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; Puppeteer&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;3-create-js-file-for-testing&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-create-js-file-for-testing&quot; aria-label=&quot;3 create js file for testing permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Create js file for testing&lt;/h2&gt;&lt;h3 id=&quot;scraperjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#scraperjs&quot; aria-label=&quot;scraperjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;scraper.js&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;puppeteer&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io/&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;screenshot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;screenshot.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Code snippet found from &lt;a href=&quot;https://github.com/GoogleChrome/puppeteer&quot; target=&quot;_blank&quot;&gt;puppeteer&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;4-test-the-scraper&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-test-the-scraper&quot; aria-label=&quot;4 test the scraper permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Test the scraper&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; scraper.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Automatically created screenshot will be saved as &lt;strong&gt;&lt;em&gt;screenshot.png&lt;/em&gt;&lt;/strong&gt; in your directory&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;screenshotpng&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#screenshotpng&quot; aria-label=&quot;screenshotpng permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;screenshot.png&lt;/h3&gt;&lt;p&gt;&lt;span class=&quot;gatsby-resp-image-wrapper&quot; style=&quot;position:relative;display:block;margin-left:auto;margin-right:auto;max-width:800px&quot;&gt;
      &lt;span class=&quot;gatsby-resp-image-background-image&quot; style=&quot;padding-bottom:74.88372093023256%;position:relative;bottom:0;left:0;background-image:url(&amp;#x27;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAACXBIWXMAAAsTAAALEwEAmpwYAAACwklEQVQ4y52UW08bRxiG959VyWUvK0WJykWrRiGp2qKiqomEmihKgtpEQEupCIgmUg4lCSIHiRDaRoFyqsFgg/F68dqs7bW96/UBYxuzPvvJ2E3S9iKKyCc9+858Gr0z883OSOVymb1cjnw+T7PZ4G1h23ZbW+Pr9XqbVpRE/598pa2SlckSNS0SqQzZwj75ot2mcNCixL5dbquVzmKJMUYiSVHkdkJhZJ8PPRYnEo0RjRsEdjSkv1bXWXR5+HvDi2NTZmVLYU1WcW0H2VRDeDUdORRl1eNjzuHk4fQMv00+YnLqKfMrK4xPTPDRseN80dXFL9eHkdZdDtyba3i8buTtLbYDCgFNRdM19HiEmBnFI28wvzjLH8+fMTX9hMWlOVJpg8yuye6uwaeffEx/3xWsRBApJv+Osf0CU50nqS2T0Z3sxd3krS2KaYWDjJ+U7sLv/hPH7ASmtkqjGKac9VNMemFfpeebU9wZ7aWW2UCaudPHi/uDLD+5jvPpr7hmbuJ5fhtlbpzg4gOCCw/QliZYnxrFPT1GzPkY3TFJaOEe2uwt4gu3+LzjQ4YunMFcuot04mQXHZ3dfPblWTq/7uGrcxfp7rnEtxd6+e7yD5y/fJVL3/dx5doAVwd+5pqg/6chBgaH6PtxkOGRUY4c/YBTpzsZGbuB5PMH8Cp+Nr0K7i2faKuihmFBCH9QQ935V1v5nXAELayjRXRCepSIOOVVpxOfooiaG0hOxzJ+RcYwE4Qjkfb/Va1WqVYqvE9IATWAYZjU6g3sUolGo0FFmFWEabPZbPffRWsRr9tSU3zK9gHFQgHh8L/ZWoaHRYrt5vDoJqqZQrUyVF5dqfc2TOXyBI0kYSuNlkiJa1WiLLZcq9XemB6qho1alXrJplYuURdUBXax+OYxOPQKrcIBsplGTWbR0nsEhIYyOZr/2fZh4iWduz3zsW1cQQAAAABJRU5ErkJggg==&amp;#x27;);background-size:cover;display:block&quot;&gt;&lt;/span&gt;
  &lt;img class=&quot;gatsby-resp-image-image&quot; alt=&quot;example&quot; title=&quot;example&quot; src=&quot;/static/6f234382f2d609e20f92ac2b9c2915ec/5a190/example.png&quot; srcSet=&quot;/static/6f234382f2d609e20f92ac2b9c2915ec/2eb24/example.png 215w,/static/6f234382f2d609e20f92ac2b9c2915ec/05ed2/example.png 430w,/static/6f234382f2d609e20f92ac2b9c2915ec/5a190/example.png 800w&quot; sizes=&quot;(max-width: 800px) 100vw, 800px&quot; style=&quot;width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0&quot; loading=&quot;lazy&quot;/&gt;
    &lt;/span&gt;&lt;/p&gt;&lt;h3 id=&quot;resizing-the-screen-size&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#resizing-the-screen-size&quot; aria-label=&quot;resizing the screen size permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Resizing the screen size&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token arrow operator&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; puppeteer&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;launch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;newPage&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setViewport&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1280&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;926&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;goto&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;https://ellismin.github.io&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;screenshot&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;screenshot.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword control-flow&quot;&gt;await&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; browser&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;setViewport&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1280&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;926&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can change size of the screen with above code.&lt;/p&gt;&lt;a href=&quot;https://ellismin.com/2019/09/puppeteer-2/&quot; target=&quot;_blank&quot;&gt;Move onto more web scraping&lt;/a&gt;</content:encoded></item><item><title><![CDATA[[JS]: Table of Contents]]></title><description><![CDATA[Dynamically generate table of contents with JavaScript]]></description><link>https://ellismin.com/2019/09/table-of-contents/</link><guid isPermaLink="false">https://ellismin.com/2019/09/table-of-contents/</guid><pubDate>Wed, 25 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h2 id=&quot;below-post-shows-how-to-create-table-of-contents-by-using-vanilla-javascript&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#below-post-shows-how-to-create-table-of-contents-by-using-vanilla-javascript&quot; aria-label=&quot;below post shows how to create table of contents by using vanilla javascript permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Below post shows how to create table of contents by using vanilla javascript&lt;/h2&gt;&lt;p&gt;&lt;em&gt;Page anchors&lt;/em&gt; allow the href links to scroll through page more conviniently. For example, creating an anchor like this&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;section2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; section title &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;allows href to auto-scroll to where above tag is placed&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Click &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;#section2&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;here &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; to read sesction 4&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;p&gt;For long posts, I wanted to create &lt;code&gt;table of contents&lt;/code&gt; links to scroll through easily&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;section&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;page__content&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css number&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h3&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Contents:&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h3&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ol&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;smallLink&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;#concat&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CONCAT&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;smallLink&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;#concat_ws&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CONCAT_WS&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;smallLink&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;#substring&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;SUBSTRING&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;smallLink&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;#replace&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;smallLink&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;#reverse&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;REVERSE&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ol&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;section&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, it can be hassel to create these links for each post. To avoid this, use of javascript can help with &lt;strong&gt;creating table of contents automatically&lt;/strong&gt; by reading certain tags in post.&lt;/p&gt;&lt;h2 id=&quot;code-reference&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#code-reference&quot; aria-label=&quot;code reference permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Code Reference&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- Static pieces of code --&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css number&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value value css language-css unit&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;token tag special-attr attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h3&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;Contents:&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;h3&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ol&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- Dynamic piece of code --&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ${ title } &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    ...&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;ol&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;1-create-string-that-are-static&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-create-string-that-are-static&quot; aria-label=&quot;1 create string that are static permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Create string that are static&lt;/h2&gt;&lt;p&gt;Build the string with js variable&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Create a string of HTML&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;div style=&amp;#x27;line-height: 60%&amp;#x27;&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;h3&amp;gt;Contents:&amp;lt;/h3&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;ol&amp;gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next following elements are dynamic, so we need to iterate them&lt;/p&gt;&lt;h2 id=&quot;2-loop-through-tags-with-jquery&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-loop-through-tags-with-jquery&quot; aria-label=&quot;2 loop through tags with jquery permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Loop through tags with jQuery&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Scan all &amp;lt;h2&amp;gt; tags in &amp;lt;sesion&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;section h2&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;3-declare-variables&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-declare-variables&quot; aria-label=&quot;3 declare variables permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Declare variables&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; link&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; elmt&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;section h2&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  elmt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  title &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; elmt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  link &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; elmt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;id&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;elmt&lt;/em&gt; is h2 tag itself. Used to extract &lt;strong&gt;&lt;em&gt;title&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;link&lt;/em&gt;&lt;/strong&gt; below&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; ${ title } &lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;4-create-and-append-dynamic-string&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#4-create-and-append-dynamic-string&quot; aria-label=&quot;4 create and append dynamic string permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;4. Create and append dynamic string&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; newLine&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; link&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; elmt&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;section h2&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  elmt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  title &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; elmt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  link &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; elmt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;id&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  newLine &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;li&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;a class=&amp;#x27;smallLink&amp;#x27; href=&amp;#x27;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    link &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;#x27;&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    title &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/li&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Append&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; newLine&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;smallLink&lt;/em&gt;&lt;/strong&gt; class is to modify fonts later(css attributes)&lt;/p&gt;&lt;h2 id=&quot;5-close-off-remaining-string&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#5-close-off-remaining-string&quot; aria-label=&quot;5 close off remaining string permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;5. Close off remaining string&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/ol&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/div&amp;gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;6-inject-html&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#6-inject-html&quot; aria-label=&quot;6 inject html permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;6. Inject HTML&lt;/h2&gt;&lt;p&gt;We want create HTML piece of code to be inserted within &lt;strong&gt;&lt;em&gt;section&lt;/em&gt;&lt;/strong&gt; tag with calss name=&amp;quot;page__content&amp;quot;. Add the following code&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.page__content&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;prepend&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;7-include-tableofcontentsjs-to-desire-post-html&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#7-include-tableofcontentsjs-to-desire-post-html&quot; aria-label=&quot;7 include tableofcontentsjs to desire post html permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;7. Include tableOfContents.js to desire post (HTML)&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;html&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-html&quot;&gt;HTML&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-html&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token tag attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag attr-value&quot;&gt;/js/tableOfContents.js&lt;/span&gt;&lt;span class=&quot;token tag attr-value punctuation&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;token tag punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;modifying-css-components-in-js&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#modifying-css-components-in-js&quot; aria-label=&quot;modifying css components in js permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Modifying CSS components in JS&lt;/h2&gt;&lt;p&gt;For &lt;strong&gt;&lt;em&gt;smallLink&lt;/em&gt;&lt;/strong&gt; class attribute, you can add CSS code snippets in JS with the following&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; editCSS &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;style&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;editCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerHTML&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;a.smallLink {font-size: 90%; margin-top: 50%;}&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;editCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;tableofcontentsjs&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#tableofcontentsjs&quot; aria-label=&quot;tableofcontentsjs permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;tableOfContents.js&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;js&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-js&quot;&gt;JS&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-js&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token dom variable&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method-variable function-variable method function property-access&quot;&gt;onload&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Create a string of HTML&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;div style=&amp;#x27;line-height: 60%&amp;#x27;&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;h3&amp;gt;Contents:&amp;lt;/h3&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;ol&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Create vars to store title, href attributes.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; title&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; link&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curElmt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; newLine &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;//curElmt used to extract text and ID&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Loop through the headers &amp;lt;h2&amp;gt; using jQuery&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;section h2&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    curElmt &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    title &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curElmt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// title for &amp;lt;h2&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    link &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;#&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; curElmt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;id&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// link for &amp;lt;h2&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    newLine &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;li&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;a class=&amp;#x27;smallLink&amp;#x27; href=&amp;#x27;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      link &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;#x27;&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      title &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/li&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; newLine&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Close off the remaining string&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/ol&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;&amp;lt;/div&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Prepend&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;.page__content&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;prepend&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token maybe-class-name&quot;&gt;ToC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;// Adding style elements with js&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; editCSS &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;style&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;editCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;innerHTML&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;a.smallLink {font-size: 90%; margin-top: 50%;}&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token dom variable&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token property-access&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token method function property-access&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;editCSS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Refining Selections]]></title><description><![CDATA[DISTINCT • ORDERBY • LIMIT • LIKE]]></description><link>https://ellismin.com/2019/09/sql-refine-select/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-refine-select/</guid><pubDate>Wed, 25 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;prepare-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#prepare-data&quot; aria-label=&quot;prepare data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Prepare data&lt;/h2&gt;&lt;h3 id=&quot;insert-more-data-from-file&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#insert-more-data-from-file&quot; aria-label=&quot;insert more data from file permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Insert more data from file&lt;/h3&gt;&lt;a href=&quot;/sql/students-2.sql&quot; target=&quot;_blank&quot;&gt;students_2.sql&lt;/a&gt;&lt;br/&gt;&lt;a href=&quot;/sql/students-2.txt&quot; target=&quot;_blank&quot;&gt;students_2.txt&lt;/a&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Insert the data on top of &lt;em&gt;students.sql&lt;/em&gt; file&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;students_2sql&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#students_2sql&quot; aria-label=&quot;students_2sql permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;students_2.sql&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;INSERT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INTO&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Dan&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Joyce&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;no_major&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;27&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Mary&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Fletcher&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Japanese 10%&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Lena&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Shah&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Food Science&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;57&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Ellis&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Min&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;Economics&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5555&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; SELECT * FROM students;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+----------+----------+------------------+------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| students_id | fname    | lname    | major            | age  | credit |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+----------+----------+------------------+------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           1 | Ellis    | Min      | Computer Science |   18 |     13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           2 | Tenzin   | Pema     | Biology          |   22 |    317 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           3 | Sam      | Smith    | Computer Science |   25 |   1211 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           4 | John     | Johnson  | Linguistics      |   19 |     21 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           5 | Dave     | Smith    | Chemistry        |   23 |     54 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           6 | Brent    | Lang     | Accounting       |   22 |     11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           7 | Jerimiah | Tucker   | Business         |   20 |     66 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           8 | Lamont   | Marks    | Biochemistry     |   18 |     37 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           9 | Diego    | Miller   | Physics          |   17 |      6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          10 | Angelina | Randall  | Art              |   26 |     41 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          11 | Brad     | Johnson  | Biology          |   22 |     13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          12 | Dan      | Joyce    | no_major         |   27 |   1000 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          13 | Mary     | Fletcher | Japanese 10%     |   16 |     25 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          14 | Lena     | Shah     | Food Science     |   31 |     57 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          15 | Ellis    | Min      | Economics        |   18 |   5555 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+----------+----------+------------------+------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;15 rows in set (0.01 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;distinct&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#distinct&quot; aria-label=&quot;distinct permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DISTINCT&lt;/h2&gt;&lt;p&gt;Returns a distinct or unique data &lt;strong&gt;without duplicates&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| major            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linguistics      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemistry        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Business         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biochemistry     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physics          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| no_major         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Japanese 10%     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Food Science     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;12 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Multiple majors such as &lt;em&gt;Computer science&lt;/em&gt; and &lt;em&gt;Biology&lt;/em&gt; are omitted&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;todo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#todo&quot; aria-label=&quot;todo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;TODO&lt;/h3&gt;&lt;p&gt;Try displaying all columns that have non distinct majors&lt;/p&gt;&lt;h3 id=&quot;distinct-for-fullname&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#distinct-for-fullname&quot; aria-label=&quot;distinct for fullname permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;DISTINCT for fullname&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CONCAT(fname,&amp;#x27; &amp;#x27;,lname) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis Min               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin Pema             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam Smith               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John Johnson            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave Smith              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent Lang              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah Tucker         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont Marks            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego Miller            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina Randall        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad Johnson            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan Joyce               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary Fletcher           |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena Shah               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;14 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname    | lname    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin   | Pema     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam      | Smith    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John     | Johnson  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave     | Smith    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    | Lang     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah | Tucker   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont   | Marks    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    | Miller   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina | Randall  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     | Johnson  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dan      | Joyce    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary     | Fletcher |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena     | Shah     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;14 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;order-by&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#order-by&quot; aria-label=&quot;order by permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ORDER BY&lt;/h2&gt;&lt;p&gt;Useful to &lt;strong&gt;sort&lt;/strong&gt; the result&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Query results are ordered alphabetically&lt;/li&gt;&lt;li&gt;Ascending by default&lt;ul&gt;&lt;li&gt;Can be used explicitly with &lt;em&gt;ORDER BY columnName ASC&lt;/em&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Select &lt;strong&gt;unique&lt;/strong&gt; last names and sort alphabetically&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| lname    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Fletcher |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Johnson  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joyce    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lang     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Marks    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Miller   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Min      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pema     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Randall  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Shah     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smith    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tucker   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;12 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Show first names in order of age&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;order-by--desc&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#order-by--desc&quot; aria-label=&quot;order by  desc permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ORDER BY ~ DESC&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Show age in descending order&lt;/li&gt;&lt;li&gt;Note: &lt;em&gt;DESC&lt;/em&gt; here is for descending. &lt;em&gt;DESC&lt;/em&gt; can also be used as alias for &lt;em&gt;DESCRIBE&lt;/em&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;order-by-2&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#order-by-2&quot; aria-label=&quot;order by 2 permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ORDER BY 2&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;ORDER BY &lt;strong&gt;&lt;em&gt;2nd argument&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;order-by-multiple-columns&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#order-by-multiple-columns&quot; aria-label=&quot;order by multiple columns permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;ORDER BY multiple columns&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Sort by last name &lt;strong&gt;first&lt;/strong&gt; then sort by first name&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;limit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#limit&quot; aria-label=&quot;limit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;LIMIT&lt;/h2&gt;&lt;p&gt;Shows specified number of results&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Shows first 5 limits regardless sorted or not&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;limit--order-by&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#limit--order-by&quot; aria-label=&quot;limit  order by permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;LIMIT &amp;amp; ORDER BY&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DISTINCT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;ORDER&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;BY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Display 5 unique ages in descending order&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;limit-2-5-not-so-common&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#limit-2-5-not-so-common&quot; aria-label=&quot;limit 2 5 not so common permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;LIMIT 2, 5 (not so common)&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Display &lt;strong&gt;&lt;em&gt;3 rows&lt;/em&gt;&lt;/strong&gt; starting from &lt;strong&gt;*3rd&lt;/strong&gt; row&lt;ul&gt;&lt;li&gt;1st arguments start from &lt;strong&gt;&lt;em&gt;index 0!&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Selects &lt;strong&gt;&lt;em&gt;11th&lt;/em&gt;&lt;/strong&gt; book&lt;ul&gt;&lt;li&gt;i.e. selecting 1 row starting from 11th row&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;18446744073709551615&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Starting from &lt;strong&gt;&lt;em&gt;4th row&lt;/em&gt;&lt;/strong&gt; show data till the end of table&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;LIMIT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;This will do the same since we have 15(3+12) rows total&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;like-wildcard-&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#like-wildcard-&quot; aria-label=&quot;like wildcard  permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;LIKE (wildcard %)&lt;/h2&gt;&lt;p&gt;Useful for better searching&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;%mi%&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Displays first and last name of students that &lt;strong&gt;have or contains &amp;quot;mi&amp;quot; in their last name&lt;/strong&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Case insensitive&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;%&lt;/em&gt;&lt;/strong&gt; is a wild card&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname | lname  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis | Min    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam   | Smith  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave  | Smith  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego | Miller |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis | Min    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;mi%&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Similarly, it displays last name of students whose last name &lt;strong&gt;starts with &amp;quot;mi&amp;quot;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| lname  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Min    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Miller |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Min    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%science%&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Shows fullname of students whose major contains word &amp;quot;science&amp;quot;&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fullname  | major            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis Min | Computer Science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam Smith | Computer Science |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lena Shah | Food Science     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;like-whilecard-___-&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#like-whilecard-___-&quot; aria-label=&quot;like whilecard ___  permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;LIKE (whilecard ___ )&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;____&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;-- Four underscores&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Shows last names that are 4 character length&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| lname |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pema  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lang  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Shah  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;_a__&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mary  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;1_&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Display teenagers&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;searching-majors-that-have----or--_--in-them&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#searching-majors-that-have----or--_--in-them&quot; aria-label=&quot;searching majors that have    or  _  in them permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Searching majors that have &amp;#x27; % &amp;#x27; or &amp;#x27; _ &amp;#x27; in them&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%\%%&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Escape it with back slash&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;LIKE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%\_%&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Similar for underscore&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[SQL]: String functions in MySQL]]></title><description><![CDATA[CONCAT • CONCAT_WS • SUBSTR • REPLACE • REVERSE • CHAR_LENGTH • UPPER/LOWER]]></description><link>https://ellismin.com/2019/09/sql-string-func/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-string-func/</guid><pubDate>Tue, 24 Sep 2019 00:00:03 GMT</pubDate><content:encoded>&lt;h3 id=&quot;mysql-string-functions&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#mysql-string-functions&quot; aria-label=&quot;mysql string functions permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;MySQL String functions&lt;/h3&gt;&lt;p&gt;More documentations can be found from:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.w3schools.com/sql/sql_ref_mysql.asp&quot;&gt;w3schools&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/string-functions.html&quot;&gt;MySQL&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;start&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#start&quot; aria-label=&quot;start permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Start&lt;/h2&gt;&lt;h3 id=&quot;example-data-files&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-data-files&quot; aria-label=&quot;example data files permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example Data files&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;/sql/students.sql&quot;&gt;students.sql&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;/sql/students.txt&quot;&gt;students.txt&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;load-the-sql-file&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#load-the-sql-file&quot; aria-label=&quot;load the sql file permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Load the sql file&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;/students.sql&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;test&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#test&quot; aria-label=&quot;test permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Test&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; DESC students;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Field       | Type        | Null | Key | Default | Extra          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| students_id | int(11)     | NO   | PRI | NULL    | auto_increment |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| fname       | varchar(50) | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| lname       | varchar(50) | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| major       | varchar(50) | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| age         | int(11)     | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| credit      | int(11)     | YES  |     | NULL    |                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------+------+-----+---------+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;6 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; SELECT * FROM students;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+----------+---------+------------------+------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| students_id | fname    | lname   | major            | age  | credit |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+----------+---------+------------------+------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           1 | Ellis    | Min     | Computer Science |   18 |     13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           2 | Tenzin   | Pema    | Biology          |   22 |    317 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           3 | Sam      | Smith   | Computer Science |   25 |   1211 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           4 | John     | Johnson | Linguistics      |   19 |     21 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           5 | Dave     | Smith   | Chemistry        |   23 |     54 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           6 | Brent    | Lang    | Accounting       |   22 |     11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           7 | Jerimiah | Tucker  | Business         |   20 |     66 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           8 | Lamont   | Marks   | Biochemistry     |   18 |     37 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|           9 | Diego    | Miller  | Physics          |   17 |      6 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          10 | Angelina | Randall | Art              |   26 |     41 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|          11 | Brad     | Johnson | Biology          |   22 |     13 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+----------+---------+------------------+------+--------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;11 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;concat&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#concat&quot; aria-label=&quot;concat permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CONCAT&lt;/h2&gt;&lt;p&gt;Combine strings(columns) for cleaner input&lt;/p&gt;&lt;h3 id=&quot;example&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example&quot; aria-label=&quot;example permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hello&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; SELECT CONCAT(&amp;#x27;hello&amp;#x27;, &amp;#x27; world!&amp;#x27;);&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CONCAT(&amp;#x27;hello&amp;#x27;, &amp;#x27; world!&amp;#x27;) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| hello world!               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;1 row in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Arguments for &lt;strong&gt;&lt;em&gt;CONCAT&lt;/em&gt;&lt;/strong&gt;&lt;ul&gt;&lt;li&gt;CONCAT(x, y, z)&lt;/li&gt;&lt;li&gt;CONCAT(column, column2)&lt;/li&gt;&lt;li&gt;CONCAT(column, &amp;#x27;some text&amp;#x27;, column, &amp;#x27;moreTexT&amp;#x27;)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;mysql&amp;gt; SELECT CONCAT(fname, &amp;#x27; &amp;#x27;, lname)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;  -&amp;gt; FROM students;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CONCAT(fname, &amp;#x27; &amp;#x27;, lname) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis Min                 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin Pema               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam Smith                 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John Johnson              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave Smith                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent Lang                |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah Tucker           |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont Marks              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego Miller              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina Randall          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad Johnson              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;11 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;using-alias&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#using-alias&quot; aria-label=&quot;using alias permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Using Alias&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;full&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;full&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+---------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| full     | last    | fullname         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+---------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ellis    | Min     | Ellis Min        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tenzin   | Pema    | Tenzin Pema      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Sam      | Smith   | Sam Smith        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John     | Johnson | John Johnson     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Dave     | Smith   | Dave Smith       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brent    | Lang    | Brent Lang       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Jerimiah | Tucker  | Jerimiah Tucker  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lamont   | Marks   | Lamont Marks     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Diego    | Miller  | Diego Miller     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Angelina | Randall | Angelina Randall |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Brad     | Johnson | Brad Johnson     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+---------+------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;11 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;concat_ws&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#concat_ws&quot; aria-label=&quot;concat_ws permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CONCAT_WS&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;CONCAT with separator&lt;/li&gt;&lt;li&gt;Useful when you concatenate a multiple fields together&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT_WS&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; - &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CONCAT_WS(&amp;#x27; - &amp;#x27;, major, lname, age) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science - Min - 18         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology - Pema - 22                 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science - Smith - 25       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linguistics - Johnson - 19          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemistry - Smith - 23              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting - Lang - 22              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Business - Tucker - 20              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biochemistry - Marks - 18           |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physics - Miller - 17               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art - Randall - 26                  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology - Johnson - 22              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;11 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;substring&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#substring&quot; aria-label=&quot;substring permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;SUBSTRING&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Parts&lt;/strong&gt; of strings&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; SUBSTRING&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hello world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Display the string from &lt;strong&gt;1st&lt;/strong&gt; char to &lt;strong&gt;4th&lt;/strong&gt; char&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| SUBSTRING(&amp;#x27;hello world!&amp;#x27;, 1, 4) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| hell                            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;1 row in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; SUBSTRING&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hellow world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Displays string from &lt;strong&gt;7th&lt;/strong&gt; char and on, inclusive&lt;/li&gt;&lt;li&gt;It will display &lt;strong&gt;&lt;em&gt;world!&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; SUBSTRING&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hello world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Starting from &lt;strong&gt;end&lt;/strong&gt; of the string, prints out &lt;strong&gt;3&lt;/strong&gt; characters&lt;/li&gt;&lt;li&gt;It will display &lt;strong&gt;&lt;em&gt;ld!&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;example-with-data&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#example-with-data&quot; aria-label=&quot;example with data permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Example with data&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; SUBSTRING&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; shortLname&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| shortLname |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Min        |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pema       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smit       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smit       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lang       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tuck       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mark       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mill       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Rand       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| John       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;11 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;substr&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#substr&quot; aria-label=&quot;substr permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;SUBSTR()&lt;/h3&gt;&lt;p&gt;You can &lt;strong&gt;&lt;em&gt;SUBSTR&lt;/em&gt;&lt;/strong&gt; is an &lt;strong&gt;alias&lt;/strong&gt; of &lt;strong&gt;&lt;em&gt;SUBSTRING&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; SUBSTR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| SUBSTR(major, -5) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ience             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ology             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ience             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| stics             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| istry             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| nting             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| iness             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| istry             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ysics             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|                   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| ology             |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;11 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Note: &lt;strong&gt;&lt;em&gt;Art&lt;/em&gt;&lt;/strong&gt; major is less than 5 characters so it shows an &lt;strong&gt;empty string&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;concat--substr&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#concat--substr&quot; aria-label=&quot;concat  substr permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CONCAT &amp;amp; SUBSTR&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    SUBSTR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;...&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; shortLname&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| shortLname |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Min...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Pem...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smi...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joh...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Smi...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lan...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Tuc...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mar...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Mil...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Ran...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Joh...     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;11 rows in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;replace&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#replace&quot; aria-label=&quot;replace permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;REPLACE&lt;/h2&gt;&lt;p&gt;Replace parts of strings&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hello world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hell&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;!@#$&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; filtered&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Replace &lt;strong&gt;all&lt;/strong&gt; occurrences of &lt;strong&gt;2nd&lt;/strong&gt; argument in &lt;strong&gt;1st&lt;/strong&gt; argument to &lt;strong&gt;3rd&lt;/strong&gt; argument&lt;/li&gt;&lt;li&gt;They are &lt;strong&gt;Case Sensitive&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| filtered     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| !@#$o world! |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;1 row in set (0.00 sec)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;get rid of spaces&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Trim spaces&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| res            |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| getridofspaces |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;h3 id=&quot;two-similar-queries&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#two-similar-queries&quot; aria-label=&quot;two similar queries permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Two similar queries&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    SUBSTRING&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;o&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;00&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res1&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; SUBSTR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;o&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;00&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res2&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;output-comparison&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#output-comparison&quot; aria-label=&quot;output comparison permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Output comparison&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| res1    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| C00mpu  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bi00l00 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| C00mpu  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lingu   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemi   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Acc00u  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Busin   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bi00ch  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physi   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bi00l00 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+---------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| res2  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| C00mp |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bi00l |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| C00mp |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lingu |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemi |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Acc00 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Busin |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bi00c |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physi |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bi00l |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;For example, &lt;strong&gt;&lt;em&gt;Computer Science&lt;/em&gt;&lt;/strong&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;res1&lt;/em&gt;&lt;/strong&gt; takes &lt;strong&gt;&lt;em&gt;COMPU&lt;/em&gt;&lt;/strong&gt; then replaces.&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;C00mpu&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;res2&lt;/em&gt;&lt;/strong&gt; replaces &lt;strong&gt;&lt;em&gt;Computer Science&lt;/em&gt;&lt;/strong&gt; with &lt;strong&gt;&lt;em&gt;C00mputer Science&lt;/em&gt;&lt;/strong&gt; then display &lt;strong&gt;5&lt;/strong&gt; characters&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;C00mp&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;todo&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#todo&quot; aria-label=&quot;todo permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;TODO&lt;/h3&gt;&lt;p&gt;Replace first three &amp;#x27;o&amp;#x27;s to &amp;#x27;00&amp;#x27;from major. Leave rest of them intact.
Ex) &lt;strong&gt;&lt;em&gt;Biology&lt;/em&gt;&lt;/strong&gt; -&amp;gt; &lt;strong&gt;&lt;em&gt;Bi00logy&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;h2 id=&quot;reverse&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#reverse&quot; aria-label=&quot;reverse permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;REVERSE&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; REVERSE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hello world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; res&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| res          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| !dlrow olleh |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+--------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; REVERSE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; palindrome&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Sandwhiches; make them palindrome&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| palindrome     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| MinniM         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| PemaameP       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| SmithhtimS     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| JohnsonnosnhoJ |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| SmithhtimS     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| LanggnaL       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| TuckerrekcuT   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| MarksskraM     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| MillerrelliM   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| RandalllladnaR |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| JohnsonnosnhoJ |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;char_length&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#char_length&quot; aria-label=&quot;char_length permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;CHAR_LENGTH&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CHAR_LENGTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hello world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| CHAR_LENGTH(&amp;#x27;hello world!&amp;#x27;) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;|                          12 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CHAR_LENGTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; len&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| major            | len  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science |   16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology          |    7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science |   16 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linguistics      |   11 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemistry        |    9 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting       |   10 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Business         |    8 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biochemistry     |   12 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physics          |    7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art              |    3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology          |    7 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+------------------+------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; is &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CHAR_LENGTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; characters long&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; custom&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| custom                                 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science is 16 characters long |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology is 7 characters long           |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Computer Science is 16 characters long |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Linguistics is 11 characters long      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemistry is 9 characters long         |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accounting is 10 characters long       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Business is 8 characters long          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biochemistry is 12 characters long     |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physics is 7 characters long           |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art is 3 characters long               |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biology is 7 characters long           |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;upper-and-lower&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#upper-and-lower&quot; aria-label=&quot;upper and lower permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;UPPER and LOWER&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;hello world!&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Returns &lt;strong&gt;uppercase&lt;/strong&gt; string of argument&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;LOWER&lt;/em&gt;&lt;/strong&gt; for returning &lt;strong&gt;lowercase&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Output&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| UPPER(&amp;#x27;hello world!&amp;#x27;) |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| HELLO WORLD!          |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;MY FAVORITE SUBJECT IS &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; FaCT&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Ellis&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| FaCT                                    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| MY FAVORITE SUBJECT IS COMPUTER SCIENCE |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-----------------------------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;side-note&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#side-note&quot; aria-label=&quot;side note permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Side note&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;UPPER&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;LOWER&lt;/em&gt;&lt;/strong&gt; takes only one argument&lt;/li&gt;&lt;li&gt;Allowed code:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;NOT allowed:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Gives an &lt;strong&gt;error&lt;/strong&gt;:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;ERROR 1582 (42000): Incorrect parameter count in the call to native function&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;This is allowed but first method would be preferred:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;practice&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#practice&quot; aria-label=&quot;practice permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Practice&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;Reverse and make uppercase of string: &amp;quot;Hi How are yOU?&amp;quot;&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;REVERSE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Hi How are yOU?&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;2&quot;&gt;&lt;li&gt;Replace spaces in major with &amp;#x27;-&amp;gt;&amp;#x27;&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;REPLACE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;-&amp;gt;&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;3&quot;&gt;&lt;li&gt;Print out fname in one col, reversed in another col&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; forward&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; REVERSE&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; backward&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;4&quot;&gt;&lt;li&gt;Show full names in uppercase&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; UPPER&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;, &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;fullName in caps&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;5&quot;&gt;&lt;li&gt;Do Ex) Sam is 25 years old&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; is &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; years old&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; blurb&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;6&quot;&gt;&lt;li&gt;Print fullname and its length&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CHAR_LENGTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; charCount&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;7&quot;&gt;&lt;li&gt;TODO(sub-query)&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; sub&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CHAR_LENGTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;sub&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; charCount&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; s&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students s &lt;/span&gt;&lt;span class=&quot;token comment&quot;&gt;--DON&amp;#x27;T put ; here?&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; sub&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Note: You can&amp;#x27;t refer to the alias you created in the first SELECT&lt;/li&gt;&lt;/ul&gt;&lt;ol start=&quot;8&quot;&gt;&lt;li&gt;Print fullname and its length - spaces&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fullname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CHAR_LENGTH&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; charCount&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&quot;9&quot;&gt;&lt;li&gt;Provide 3 cols: &lt;strong&gt;&lt;em&gt;Compu...&lt;/em&gt;&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;Min, Ellis&lt;/em&gt;&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;\$13 left in credit&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;SUBSTR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;major&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;...&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;short major&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;lname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;, &amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; fname&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    CONCAT&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27;$&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; credit&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;#x27; left in credit&amp;#x27;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; balance&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; students&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------------+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| short major | fname             | balance              |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------------+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Compu...    | Min, Ellis        | $13 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biolo...    | Pema, Tenzin      | $317 left in credit  |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Compu...    | Smith, Sam        | $1211 left in credit |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Lingu...    | Johnson, John     | $21 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Chemi...    | Smith, Dave       | $54 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Accou...    | Lang, Brent       | $11 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Busin...    | Tucker, Jerimiah  | $66 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Bioch...    | Marks, Lamont     | $37 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Physi...    | Miller, Diego     | $6 left in credit    |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Art...      | Randall, Angelina | $41 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| Biolo...    | Johnson, Brad     | $13 left in credit   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+-------------+-------------------+----------------------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[Git]: reset]]></title><description><![CDATA[How to undo previous commits on git]]></description><link>https://ellismin.com/2019/09/git-reset/</link><guid isPermaLink="false">https://ellismin.com/2019/09/git-reset/</guid><pubDate>Tue, 24 Sep 2019 00:00:02 GMT</pubDate><content:encoded>&lt;h2 id=&quot;deletingundoing-the-last-commit&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#deletingundoing-the-last-commit&quot; aria-label=&quot;deletingundoing the last commit permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Deleting(undoing) the last commit&lt;/h2&gt;&lt;h3 id=&quot;1-undo-commit-keeping-all-files-staged&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#1-undo-commit-keeping-all-files-staged&quot; aria-label=&quot;1 undo commit keeping all files staged permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;1. Undo commit keeping all files staged&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; reset --soft HEAD~&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;2-undo-commit-and-un-stage-all-files&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#2-undo-commit-and-un-stage-all-files&quot; aria-label=&quot;2 undo commit and un stage all files permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;2. Undo commit and un-stage all files&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; reset HEAD~&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&quot;3-undo-commit-and-completely-remove-all-changes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#3-undo-commit-and-completely-remove-all-changes&quot; aria-label=&quot;3 undo commit and completely remove all changes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;3. Undo commit and completely remove all changes&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; reset --hard HEAD~&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;note&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#note&quot; aria-label=&quot;note permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Note&lt;/h2&gt;&lt;ul&gt;&lt;li&gt;HEAD~[Num]: &lt;code&gt;[Num]&lt;/code&gt; is the number of commits to go back&lt;ul&gt;&lt;li&gt;&lt;code&gt;HEAD&lt;/code&gt;: current commit&lt;/li&gt;&lt;li&gt;&lt;code&gt;HEAD~1&lt;/code&gt; ≣ &lt;code&gt;HEAD~&lt;/code&gt;: 1 commit before&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Instead of &lt;code&gt;HEAD~*&lt;/code&gt;, you can use commit id by logging with &lt;code&gt;git log --oneline&lt;/code&gt;&lt;ul&gt;&lt;li&gt;i.e. &lt;code&gt;git reset --soft 858da45&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[[Git]: log]]></title><description><![CDATA[How to show history of commits on git]]></description><link>https://ellismin.com/2019/09/git-log/</link><guid isPermaLink="false">https://ellismin.com/2019/09/git-log/</guid><pubDate>Tue, 24 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Lists the commits made in the repo in reverse chronological order&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;-4&lt;/em&gt;&lt;/strong&gt; flag shows 4 most recent commits&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ git log -4&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;commit f9089e71kdiendjef437d2948200bfaf86e00ce4 (HEAD -&amp;gt; master, origin/master)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Author: Ellis Min&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Date:   Tue Sep 24 15:23:21 2019 -0500&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;commit 1a918ba16oriejc01ea3353c68b81a420b42d039&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Author: Ellis Min&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Date:   Tue Sep 24 15:18:16 2019 -0500&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;commit ppe31720765e33cdec6c3f50c16b662f51eb29c1&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Author: Ellis Min&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Date:   Tue Sep 24 15:16:33 2019 -0500&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;commit db020060bad7ebf2e286d2a52574f055fd27b454&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Author: Ellis Min&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Date:   Tue Sep 24 15:13:57 2019 -0500&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;: &amp;lt;!-- press q to quit --&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log -p&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Displays the &lt;strong&gt;differences&lt;/strong&gt; (&lt;em&gt;-p for -patch&lt;/em&gt;)&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ git log -p -1&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;commit f9089e719eac344ef437d2948200bfaf86e00ce4 (HEAD -&amp;gt; master, origin/master)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Author: Ellis Min&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Date:   Tue Sep 24 15:23:21 2019 -0500&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;diff --git a/_posts/2019-04-15-sample_post.md b/_posts/2019-04-15-sample_post.md&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;index adfc823..59caefb 100644&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;--- a/_posts/2019-04-15-sample_post.md&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+++ b/_posts/2019-04-15-sample_post.md&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;@@ -1,7 +1,7 @@&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; ---&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; title: &amp;quot;Sample Post&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; date: 2019-04-15&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;-tags:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+tags: [Markdown]&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; header:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;   image:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; excerpt: &amp;quot;My first post&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;@@ -79,4 +79,21 @@ line breaks&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;     Using&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; pre tag   within&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;   div container.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;-&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;\ No newline at end of file&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+### Similar code snippets for shell/bash&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+* shell&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+```shell&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+$ git log --pretty=format:&amp;quot;%h - %an, %ar : %s&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+```&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+* &lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+```&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+$ git log --pretty=format:&amp;quot;%h - %an, %ar : %s&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+```&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+* bash&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+```bash&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+$ git log --pretty=format:&amp;quot;%h - %an, %ar : %s&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+```&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;\ No newline at end of file&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log --stat&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Shows &lt;strong&gt;abbreviated stats&lt;/strong&gt; for each commit&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ git log --stat -2&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;commit 8291cfac2c051fe857dfadcd44a19eb7820d94ba (HEAD -&amp;gt; master, origin/master)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Author: Ellis Min &amp;lt;dbmin@hotmail.com&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Date:   Tue Sep 24 15:53:07 2019 -0500&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; _posts/2019-09-25-gitlog.md | 85 ++++-----------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; 1 file changed, 6 insertions(+), 79 deletions(-)&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;commit 4667df2269ff2adcaf0943f35882a8b5b3f918d9&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Author: Ellis Min &amp;lt;dbmin@hotmail.com&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;Date:   Tue Sep 24 15:51:16 2019 -0500&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; _posts/2019-09-25-gitlog.md     |  2 --&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; _posts/2019-09-25-stringfunc.md | 27 +++++++++++++++++++++++++++&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt; 2 files changed, 27 insertions(+), 2 deletions(-)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log --pretty&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;format:&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;%h - %an, %ar : %s&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;--pretty&lt;/em&gt;&lt;/strong&gt; tag changes log output to differnet formats&lt;/li&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ git log --pretty=format:&amp;quot;%h - %an, %ar : %s&amp;quot; -3&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;753f534 - Ellis Min, 2 minutes ago : modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;e54279b - Ellis Min, 4 minutes ago : modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;8291cfa - Ellis Min, 10 minutes ago : modified post&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log --oneline -4&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Prints last 4 commits on a &lt;strong&gt;single line&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;same as:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-bash&quot;&gt;BASH&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-bash&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; log --pretty&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;oneline -4&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Output:&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;$ git log --oneline -4&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;753f534 (HEAD -&amp;gt; master, origin/master) modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;e54279b modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;8291cfa modified post&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;4667df2 modified post&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[SQL]: CRUD commands]]></title><description><![CDATA[SELECT • WHERE • UPDATE • DELETE FROM]]></description><link>https://ellismin.com/2019/09/sql-crud/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-crud/</guid><pubDate>Tue, 24 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h1 id=&quot;most-common-operations-in-database-or-others&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#most-common-operations-in-database-or-others&quot; aria-label=&quot;most common operations in database or others permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Most common operations in database (or others)&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;C&lt;/strong&gt;reate (CREATE, INTERT INTO)&lt;/li&gt;&lt;li&gt;&lt;strong&gt;R&lt;/strong&gt;ead (SELECT)&lt;/li&gt;&lt;li&gt;&lt;strong&gt;U&lt;/strong&gt;pdate (UPDATE)&lt;/li&gt;&lt;li&gt;&lt;strong&gt;D&lt;/strong&gt;elete (DROP, DELETE)&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;read&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#read&quot; aria-label=&quot;read permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;READ&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Retrieve all(*) colummns from &lt;strong&gt;&lt;em&gt;dogs&lt;/em&gt;&lt;/strong&gt; table&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Shows &lt;strong&gt;&lt;em&gt;name&lt;/em&gt;&lt;/strong&gt; column&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Display a &lt;strong&gt;multiple&lt;/strong&gt; columns in &lt;strong&gt;order typed&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Get all columns where &lt;strong&gt;&lt;em&gt;age=5&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Buzz&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Get all columns where &lt;strong&gt;&lt;em&gt;name=&amp;quot;Buzz&amp;quot;&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;Again, &lt;strong&gt;case insensitive&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Fizz&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Show age column where &lt;strong&gt;&lt;em&gt;name=&amp;quot;Fizz&amp;quot;&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogId&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Display all columns where &lt;strong&gt;&lt;em&gt;id=age&lt;/em&gt;&lt;/strong&gt;;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;aliases-as&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#aliases-as&quot; aria-label=&quot;aliases as permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Aliases (AS)&lt;/h3&gt;&lt;p&gt;We can set up how data is displayed&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogId &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;AS&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Shows &lt;strong&gt;&lt;em&gt;dogID&lt;/em&gt;&lt;/strong&gt; column as &lt;strong&gt;&lt;em&gt;id&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;Doesn&amp;#x27;t change the real data&lt;/li&gt;&lt;li&gt;Useful for Join tables (upcoming)&lt;/li&gt;&lt;li&gt;AS can be skipped and used as&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;SELECT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogID id&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;update&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#update&quot; aria-label=&quot;update permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Update&lt;/h2&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Loxi&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Change Loxi&amp;#x27;s age to 14&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;changing-multiple-attributes&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#changing-multiple-attributes&quot; aria-label=&quot;changing multiple attributes permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Changing multiple attributes&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Lucky&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Loxi&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Change Loxi&amp;#x27;s name to Lucky and set age to 5&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;changing-multiple-rows&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#changing-multiple-rows&quot; aria-label=&quot;changing multiple rows permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Changing multiple rows&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;BUZZ&amp;quot;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;OR&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Lucky&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Set Buzz and Lucky&amp;#x27;s age to 13&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;UPDATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;SET&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;111&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Set all dogs&amp;#x27; age to 111&lt;/li&gt;&lt;/ul&gt;&lt;h3 id=&quot;important&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#important&quot; aria-label=&quot;important permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Important&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Try &lt;strong&gt;SELECT&lt;/strong&gt;ing before &lt;strong&gt;UPDATE&lt;/strong&gt;. It&amp;#x27;s a good practice to avoid updating data that you don&amp;#x27;t want&lt;/li&gt;&lt;li&gt;Same for deletion(next content)&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;delete&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#delete&quot; aria-label=&quot;delete permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Delete&lt;/h2&gt;&lt;p&gt;Usage for deletion is similar to SLECT&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;WHERE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&amp;quot;Buzz&amp;quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Delete data where &lt;strong&gt;&lt;em&gt;name=&amp;quot;Buzz&amp;quot;&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;Try &lt;strong&gt;SELECTing first!&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;dogId&lt;/em&gt;&lt;/strong&gt; for other rows won&amp;#x27;t alter&lt;ul&gt;&lt;li&gt;After &lt;strong&gt;deletion&lt;/strong&gt; and another &lt;strong&gt;insertion&lt;/strong&gt; the &lt;strong&gt;primary key will NOT&lt;/strong&gt; make up for the removed row&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DELETE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Delete all dogs or all rows&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Table&lt;/strong&gt; still exists! When desired, don&amp;#x27;t forget to drop it with&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;DROP&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; dogs&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[[SQL]: Primary Key]]></title><description><![CDATA[PRIMARY KEY • AUTO_INCREMENT]]></description><link>https://ellismin.com/2019/09/sql-pk/</link><guid isPermaLink="false">https://ellismin.com/2019/09/sql-pk/</guid><pubDate>Sun, 22 Sep 2019 00:00:01 GMT</pubDate><content:encoded>&lt;h3 id=&quot;consider-this-situation&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#consider-this-situation&quot; aria-label=&quot;consider this situation permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Consider this situation..&lt;/h3&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name     | age      |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;We want our data to be &lt;strong&gt;uniquely identifiable&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;For instance, we can add &lt;strong&gt;&lt;em&gt;userID&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-text&quot;&gt;TEXT&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-text&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| name     | age      | userID   |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |        1 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |        2 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |        3 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;| sameName | 23       |        4 |&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;+----------+----------+----------+&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&quot;primary-key-a-unique-identifier&quot; style=&quot;position:relative&quot;&gt;&lt;a href=&quot;#primary-key-a-unique-identifier&quot; aria-label=&quot;primary key a unique identifier permalink&quot; class=&quot;anchor-heading before&quot;&gt;&lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Primary Key: A Unique Identifier&lt;/h2&gt;&lt;p&gt;Assigning a new primary key:&lt;/p&gt;&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;sql&quot;&gt;&lt;div class=&quot;badge-btn-wrap&quot;&gt;&lt;div class=&quot;language-badge language-badge-sql&quot;&gt;SQL&lt;/div&gt;&lt;button class=&quot;btn-copy&quot;&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre class=&quot;prism-code language-sql&quot;&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; uniqueUsers&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    userID &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;NOT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;PRIMARY&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt; &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;KEY&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    name &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;    age &lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;INT&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;token-line&quot;&gt;&lt;span class=&quot;token plain&quot;&gt;&lt;/span&gt;&lt;span 