<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maciej Trzciński 🌱🇵🇱</title>
    <description>The latest articles on DEV Community by Maciej Trzciński 🌱🇵🇱 (@maciejtrzcinski).</description>
    <link>https://dev.to/maciejtrzcinski</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F407510%2F2165ffe1-9df6-4a05-9d5b-fe81faf7dff3.jpeg</url>
      <title>DEV Community: Maciej Trzciński 🌱🇵🇱</title>
      <link>https://dev.to/maciejtrzcinski</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maciejtrzcinski"/>
    <language>en</language>
    <item>
      <title>Every Sanity page builder has the same bug</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Mon, 29 Jun 2026 15:47:38 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/every-sanity-page-builder-has-the-same-bug-k1c</link>
      <guid>https://dev.to/maciejtrzcinski/every-sanity-page-builder-has-the-same-bug-k1c</guid>
      <description>&lt;p&gt;Every Sanity marketing site ends up with a page builder. An array of sections, an insert menu, a render loop that maps &lt;code&gt;block._type&lt;/code&gt; to a component. You've built it. I've built it. We've all built the same thing.&lt;/p&gt;

&lt;p&gt;And every one of them ships with the same bug.&lt;/p&gt;

&lt;p&gt;You add a new section. You wire it into the schema. You add a renderer. You add a component. You add the type. And then — because there are &lt;em&gt;five&lt;/em&gt; places to touch and you're a human — you forget one. The section renders blank in production. Or it never shows up in the insert menu. Or it fetches no fields because you missed the GROQ projection, so it renders as nothing at all. No error. No red. Just a hole on the page where a section should be.&lt;/p&gt;

&lt;p&gt;The annoying part isn't the bug. It's that you'll hit it again on the next project, in exactly the same way, because you rewrote the whole thing from scratch — again.&lt;/p&gt;

&lt;h2&gt;
  
  
  The section tax
&lt;/h2&gt;

&lt;p&gt;Here's what "add a section" actually costs in a typical Sanity + Next.js page builder:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Schema&lt;/strong&gt; — a new &lt;code&gt;*Section&lt;/code&gt; object type, registered in your schema index.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GROQ&lt;/strong&gt; — a new conditional in the page-builder projection so the block's fields actually come down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Component&lt;/strong&gt; — the React component that renders it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Renderer map&lt;/strong&gt; — an entry mapping &lt;code&gt;_type&lt;/code&gt; → component.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Types&lt;/strong&gt; — the block variant in whatever union your frontend renders.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Miss #2 and the block arrives empty. Miss #4 and it silently skips. Miss #5 and TypeScript shrugs because your union is hand-maintained and now lies. Three different failure modes, all of them quiet, all of them "works on my machine until it doesn't."&lt;/p&gt;

&lt;p&gt;Now look at those five places and ask: &lt;strong&gt;which of them is actually unique to your site?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The component is. It's welded to your design system — your spacing, your tokens, your brand. Nobody can reuse it and nobody should.&lt;/p&gt;

&lt;p&gt;The other four are &lt;em&gt;plumbing&lt;/em&gt;. "Look up &lt;code&gt;_type&lt;/code&gt; in a map, call the renderer, keep the map in sync with the schema and the query." That code is byte-for-byte the same idea on every project you've ever built. So why is it living in your repo, hand-rolled, drifting, for the fifth time?&lt;/p&gt;

&lt;h2&gt;
  
  
  Extract the plumbing, keep the sections
&lt;/h2&gt;

&lt;p&gt;The split that works: your sections stay yours, and the generic dispatcher becomes a dependency you don't think about. That's the whole bet behind the two packages I pulled out of doing this one too many times — &lt;a href="https://www.npmjs.com/package/@maciejtrzcinski/sanity-page-builder-core" rel="noopener noreferrer"&gt;&lt;code&gt;@maciejtrzcinski/sanity-page-builder-core&lt;/code&gt;&lt;/a&gt; (frontend) and &lt;a href="https://www.npmjs.com/package/@maciejtrzcinski/sanity-plugin-section-builder" rel="noopener noreferrer"&gt;&lt;code&gt;@maciejtrzcinski/sanity-plugin-section-builder&lt;/code&gt;&lt;/a&gt; (Studio).&lt;/p&gt;

&lt;p&gt;But forget the packages for a second — the &lt;em&gt;pattern&lt;/em&gt; is the point. They're just the convenient version of it.&lt;/p&gt;

&lt;h3&gt;
  
  
  One source of truth per section
&lt;/h3&gt;

&lt;p&gt;The drift happens because a section's &lt;code&gt;type&lt;/code&gt;, its GROQ &lt;code&gt;query&lt;/code&gt;, and its &lt;code&gt;render&lt;/code&gt; live in three different files. Co-locate them and they can't drift:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;defineSection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createSectionFactory&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;PageBuilderBlock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;RenderContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ReactNode&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hero&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineSection&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;heroSection&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`title, subtitle, ctaHref`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;render&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;block&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Hero&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;block&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;,
&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type, query, renderer — in one object. Now you can't add a renderer and forget the projection, because they're the same declaration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build the render loop &lt;em&gt;and&lt;/em&gt; the GROQ from the same list
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createPageBuilderFromSections&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;hero&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="cm"&gt;/* … */&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;strict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;pb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;renderBlock&lt;/span&gt;   &lt;span class="c1"&gt;// dispatch a block to its renderer&lt;/span&gt;
&lt;span class="nx"&gt;pb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;         &lt;span class="c1"&gt;// `_type == "heroSection" =&amp;gt; { title, subtitle, ctaHref }, …`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The combined GROQ projection is &lt;em&gt;derived&lt;/em&gt; from your sections, not typed out by hand next to them. The thing that used to silently fall out of sync is now generated from the same source as the renderers. That's the entire class of "section renders blank because I forgot the query" — gone.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;strict: true&lt;/code&gt; means a block whose &lt;code&gt;_type&lt;/code&gt; has no renderer throws instead of silently skipping. Forgetting to register a section becomes loud.&lt;/p&gt;

&lt;h3&gt;
  
  
  Make the compiler enforce parity
&lt;/h3&gt;

&lt;p&gt;The dispatcher is generic over &lt;em&gt;your&lt;/em&gt; block union, so the renderer map is a mapped type over &lt;code&gt;block._type&lt;/code&gt;. The compiler enforces exactly one correctly-typed renderer per variant — each renderer receives the narrowed block, no casts. Add a section to the union, forget its renderer, and the build goes red before you ever ship the blank.&lt;/p&gt;

&lt;p&gt;And for the parts a type system can't see (the registered schema types, the runtime GROQ string), there's one assertion you drop in a test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;assertPageBuilderIntegrity&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;renderers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;registeredTypes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;pageBuilderFields&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It fails loudly the moment your renderer map, your registered sections, and your projection drift apart. The five-places bug becomes a failing test in CI instead of a hole on a live page.&lt;/p&gt;

&lt;p&gt;The core is dependency-free, by the way — the node type is a generic parameter, so it doesn't drag React or Sanity in. You can read the whole thing in one sitting. That's deliberate: it's plumbing, it should be boring and small.&lt;/p&gt;

&lt;h2&gt;
  
  
  The other half: a Studio that doesn't suck to use
&lt;/h2&gt;

&lt;p&gt;The render loop is the frontend. The other recurring tax is the Studio side — the insert menu that's just a list of type names, and the &lt;code&gt;components: { preview: … }&lt;/code&gt; block you copy-paste into every single section schema so editors get a thumbnail.&lt;/p&gt;

&lt;p&gt;The plugin attaches previews globally and auto-detects your sections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// sanity.config.ts&lt;/span&gt;
&lt;span class="nx"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;sectionBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;SECTIONS&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;

&lt;span class="c1"&gt;// your page document&lt;/span&gt;
&lt;span class="nx"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;sectionField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;SECTIONS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;content&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;})]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Drop in a &lt;code&gt;*Section&lt;/code&gt; type and it's picked up automatically. Previews resolve by filename convention — name a section &lt;code&gt;heroSection&lt;/code&gt;, drop &lt;code&gt;hero-section.png&lt;/code&gt; in your previews folder, and it shows up in the array editor, the edit pane, and the native insert-menu grid. No per-schema wiring, no hand-maintained map. Your editors get a visual grid; you delete code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape, end to end
&lt;/h2&gt;

&lt;p&gt;Two sources of truth — the section list on each side — and the packages do the wiring between them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Studio
  sectionBuilder&lt;span class="o"&gt;(&lt;/span&gt;SECTIONS&lt;span class="o"&gt;)&lt;/span&gt;   → thumbnails everywhere
  sectionField&lt;span class="o"&gt;(&lt;/span&gt;SECTIONS&lt;span class="o"&gt;)&lt;/span&gt;     → the page-builder array + insert grid

Frontend
  defineSection&lt;span class="o"&gt;({&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;, query, render &lt;span class="o"&gt;})&lt;/span&gt; × N
  createPageBuilderFromSections&lt;span class="o"&gt;(&lt;/span&gt;...&lt;span class="o"&gt;)&lt;/span&gt;  → renderBlock + combined GROQ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I put a full working version up so you don't have to take my word for it: a minimal Next.js + Sanity app, five sections (Hero, Feature Cards, Quote, FAQ, CTA Banner), a &lt;code&gt;/[...slug]&lt;/code&gt; catch-all route, plus the stuff every real marketing site needs anyway — CMS-driven SEO metadata, Open Graph, JSON-LD, sitemap/robots, ISR + Live caching, and a revalidation webhook. Clone it, &lt;code&gt;pnpm seed&lt;/code&gt;, and you've got a page builder running in a few minutes.&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;&lt;a href="https://github.com/maciejtrzcinski/sanity-page-builder-example" rel="noopener noreferrer"&gt;github.com/maciejtrzcinski/sanity-page-builder-example&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The point
&lt;/h2&gt;

&lt;p&gt;You're going to build a page builder on your next Sanity marketing site. You already know how — that's the problem. Knowing how means rewriting the same drift-prone plumbing for the fifth time and re-discovering the same silent bug.&lt;/p&gt;

&lt;p&gt;Keep your sections. They're the part that's actually yours. Let the boring dispatcher be a dependency that fails loudly when you forget a wire, instead of a hand-rolled thing that fails quietly in front of a client.&lt;/p&gt;

&lt;p&gt;If you try it, tell me where it breaks — issues and PRs welcome, and a star helps other people find it.&lt;/p&gt;

</description>
      <category>sanity</category>
      <category>typescript</category>
      <category>nextjs</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Store text inside variables instead of inline.</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Mon, 29 Nov 2021 09:37:59 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/store-text-inside-variables-instead-of-inline-ng7</link>
      <guid>https://dev.to/maciejtrzcinski/store-text-inside-variables-instead-of-inline-ng7</guid>
      <description>&lt;p&gt;Why does text stored inside variables give you flexibility and control?&lt;/p&gt;

&lt;p&gt;Before I wrote this article, I’ve tried a couple of times to write down my thoughts. Let me explain first what I called inline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CopyText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Heading&lt;/span&gt; &lt;span class="na"&gt;tag&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"h2"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  Lorem Ipsum dolores set.
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;CopyText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Heading&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example showed you what I meant as an inline text.&lt;/p&gt;

&lt;p&gt;Let’s go straight forward to the point:&lt;br&gt;
When you are a programmer, and you have been writing the code. One of the most important parts is clarity of your own code. The clarity sometimes defines if you’re engaged. &lt;/p&gt;

&lt;p&gt;I wrote some rules how our code could be more efficient by using vars instead of pure text.&lt;/p&gt;

&lt;p&gt;Firstly, when you got the message from the marketing team with new needs, you as a programmer gonna replace the text manually. Trust me, it isn’t easy to find text covered by components. Since I have been using const instead of inline text, my life become easier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Title`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Description`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// component &lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Secondly, client or even you during the project lifecycle can decide to use API to manage the page. When you got all text stored inside variables, the change is easy-peasy to the implementation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// old variables&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Title`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Description`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// new API&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;API&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// component &lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thirdly, in some cases, the structure requires displaying column of the same components with different content. It’s easier to use map and display each component in simple way, than copying one by one - this solution reduce code and complexity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Title`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Description&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Title`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Description`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Title`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Description`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// component &lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Parent&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Parent&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key takeaways:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;const variable is easier to find and replace&lt;/li&gt;
&lt;li&gt;const variable reduce complexity of components &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>4 amazing web tools for prototyping.</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Thu, 20 May 2021 12:00:32 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/4-amazing-web-tools-for-prototyping-1g12</link>
      <guid>https://dev.to/maciejtrzcinski/4-amazing-web-tools-for-prototyping-1g12</guid>
      <description>&lt;p&gt;Today I'm going to show you 4 amazing tools to save you time when you prototyping.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. &lt;a href="https://placeholder.com" rel="noopener noreferrer"&gt;Placeholder.com&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n41pzjqtlq4psdgtm6s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n41pzjqtlq4psdgtm6s.png" alt="Placeholder.com" width="799" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is amazing placeholder tool for images. You can generate what size you want, color, format and text content🤳🏼.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kqwzjwxf9ghj8b1rukk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kqwzjwxf9ghj8b1rukk.png" alt="Placeholder.com example" width="800" height="99"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you visit this URL &lt;a href="https://via.placeholder.com/728x90.png/0000FF/FFFFFF?text=Hello,+How+are+you?" rel="noopener noreferrer"&gt;https://via.placeholder.com/728x90.png/0000FF/FFFFFF?text=Hello,+How+are+you?&lt;/a&gt;, you receive exactly the same image.&lt;/p&gt;

&lt;p&gt;Please go to the &lt;a href="//Placeholder.com"&gt;Placeholder.com&lt;/a&gt; and look at the documentation.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. &lt;a href="https://ihateregex.io/" rel="noopener noreferrer"&gt;iHateRegex&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzzfzko7oj3rivw0ld0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzzfzko7oj3rivw0ld0x.png" alt="iHateRegex" width="799" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two types of people, who are familiar with Regex and who aren't.&lt;/p&gt;

&lt;p&gt;99% of programmers aren't familiar in 100%, for me this page is really helpful on daily programming.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. &lt;a href="http://jsonplaceholder.typicode.com/" rel="noopener noreferrer"&gt;{JSON} Placeholder&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwlpi9ddsrjrlpliqdiz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwlpi9ddsrjrlpliqdiz.png" alt="{JSON} Placeholder" width="799" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This a great tool when you don't have API, and you want to test some part of code, or you are just learning and you don't want to write your own backend.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/todos/1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"userId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"delectus aut autem"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"completed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  4. &lt;a href="https://ngrok.com/docs" rel="noopener noreferrer"&gt;ngrok&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fimbzfkwor7bhguu1p8gl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fimbzfkwor7bhguu1p8gl.png" alt="ngrok" width="799" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another great tool is ngrok, where using one command you can preview your work.&lt;/p&gt;

&lt;p&gt;Example of usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ngrok http 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/@jannerboy62?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Nick Fewings&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/four-tools?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Have you heard of the download html attribute?</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Thu, 11 Feb 2021 11:30:45 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/have-you-heard-of-the-download-html-attribute-3682</link>
      <guid>https://dev.to/maciejtrzcinski/have-you-heard-of-the-download-html-attribute-3682</guid>
      <description>&lt;p&gt;The download attribute specifies that the target will be downloaded after a user clicks.&lt;br&gt;
Also, when you set value to download, the file after download will have this name, in my particular example the file will named &lt;code&gt;Awesome-Company.pdf&lt;/code&gt; after download.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;/**
*  download - this is information for breowser that the link will download file
*  value - here you can set name for file
**/
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/uploads/company-info.pdf"&lt;/span&gt; &lt;span class="na"&gt;download=&lt;/span&gt;&lt;span class="s"&gt;"Awesome-Company"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;If you like this article, follow me on Twitter &lt;a href="https://twitter.com/MaciejDEV" rel="noopener noreferrer"&gt;@MaciejDEV&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>HTML autocomplete "one-time-code".</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Wed, 10 Feb 2021 15:54:06 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/html-autocomplete-one-time-code-357g</link>
      <guid>https://dev.to/maciejtrzcinski/html-autocomplete-one-time-code-357g</guid>
      <description>&lt;p&gt;Using only html autocomplete (&lt;code&gt;autocomplete="one-time-code"&lt;/code&gt;) you can autofill inputs using security codes sent by SMS providers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;auth-token&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;inputmode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;numeric&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;pattern&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;[0-9]*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;autocomplete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;one-time-code&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuw8vo905704qo082a6o6.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuw8vo905704qo082a6o6.jpeg" alt="Security code" width="637" height="679"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;If you like this article, follow me on Twitter &lt;a href="https://twitter.com/MaciejDEV" rel="noopener noreferrer"&gt;@MaciejDEV&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Do you have some kind of Pull Request Score in your company?</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Sun, 20 Dec 2020 13:25:13 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/do-you-have-some-kind-of-pull-request-score-in-your-company-12ij</link>
      <guid>https://dev.to/maciejtrzcinski/do-you-have-some-kind-of-pull-request-score-in-your-company-12ij</guid>
      <description>&lt;p&gt;I meant some kind of score, how good is your PR (how many bugs have)&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Reviewer found 3 bugs in PR, then PR author lose 3 points from overall score. (Like motivation system)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Common JavaScript Tips</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Sat, 19 Dec 2020 16:09:12 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/common-javascript-mistakes-2c2n</link>
      <guid>https://dev.to/maciejtrzcinski/common-javascript-mistakes-2c2n</guid>
      <description>&lt;p&gt;Bellow, I will explain you some popular JavaScript mistakes&lt;/p&gt;

&lt;h2&gt;
  
  
  Use const/let instead of var
&lt;/h2&gt;

&lt;p&gt;Replace old fashioned &lt;code&gt;var&lt;/code&gt; with new &lt;code&gt;const&lt;/code&gt;, that will guarantee you better condition of your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// bad&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;

&lt;span class="c1"&gt;// good&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you really need to change variable use &lt;code&gt;let&lt;/code&gt;, it’s like &lt;code&gt;var&lt;/code&gt; but &lt;code&gt;let&lt;/code&gt; has block range, var has functional range.&lt;/p&gt;

&lt;p&gt;What is block variable?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Block variable&lt;/strong&gt; you can read only in defined block of code where was defined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;

  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="c1"&gt;//variable j range&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//ReferenceError: i is not defined&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Functional variable&lt;/strong&gt; you can read inside whole function not only in the code block.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 

  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;

  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//10&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are in block range.&lt;/p&gt;




&lt;h2&gt;
  
  
  Use Template Literals
&lt;/h2&gt;

&lt;p&gt;Manually joining string with &lt;code&gt;+&lt;/code&gt; it’s terrible, it’s bad for refactoring and code readability. The best way for joining words is Template Literals.&lt;/p&gt;

&lt;p&gt;If you earlier joined words like that, read this chapter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Maciej&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;wave&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I’ll compare the old method with Template Literals.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Maciej&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Hello &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, wave`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s more clear, right?&lt;/p&gt;

&lt;p&gt;In Template Literals you can easily add new lines with only just enter button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Maciej&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Hello &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;

,wave`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Copy array with spread operator
&lt;/h2&gt;

&lt;p&gt;I think every one of us sometimes must copy the array, but only half of us know about spread operator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;//bad&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;

  &lt;span class="nx"&gt;newArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//good&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax" rel="noopener noreferrer"&gt;Reference on MDN&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Conditional operators
&lt;/h2&gt;

&lt;p&gt;Every one of us sometimes must or want to use conditional operators from some reasons, sometimes you want to save a couple of lines or make the code cleaner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Like you see on the above snippet, this is not perfect code it's looks weird.&lt;/p&gt;

&lt;p&gt;Below you will see easier way.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tadam! Looks better, right?&lt;/p&gt;

&lt;p&gt;Thanks for reading 🙏&lt;/p&gt;




&lt;p&gt;Changelog:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;07/22/2020&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Added:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use const/let instead of var &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Template Literals&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy array with spread operator&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conditional operator&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you like this article, please follow me on Twitter &lt;a href="https://twitter.com/MaciejDEV" rel="noopener noreferrer"&gt;@MaciejDEV&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Photo by NeONBRAND on Unsplash&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>100vh problem with iOS Safari</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Sun, 13 Dec 2020 11:19:03 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/100vh-problem-with-ios-safari-3ge9</link>
      <guid>https://dev.to/maciejtrzcinski/100vh-problem-with-ios-safari-3ge9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw3vy0uveuvz6s4naqaf8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw3vy0uveuvz6s4naqaf8.jpg" alt="100vh" width="800" height="886"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The web content it's outside the viewport although we used &lt;code&gt;100vh&lt;/code&gt; (the red opacity box with &lt;code&gt;100vh&lt;/code&gt; text).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.section&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="err"&gt;//&lt;/span&gt; &lt;span class="err"&gt;bad&lt;/span&gt; &lt;span class="err"&gt;approach&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The problem you have been receiving after adding the &lt;code&gt;height: 100vh&lt;/code&gt; to mobile resolutions. It happens due to the calculation method which Safari and Chrome are using. Mobile devices calc browser viewport as (&lt;strong&gt;top bar + document + bottom bar&lt;/strong&gt;) = &lt;code&gt;100vh&lt;/code&gt;. I had a hard time with &lt;code&gt;100vh&lt;/code&gt; when the page have to have a section filled the whole screen. After a couple of hours, I've found the solutions that I show you.  &lt;/p&gt;

&lt;p&gt;They are two solutions, the first needs JavaScript and CSS, the second solution required only CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. JS &amp;amp; CSS solution
&lt;/h3&gt;

&lt;p&gt;Let’s get started first with the JS file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;appHeight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;documentElement&lt;/span&gt;
    &lt;span class="nx"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setProperty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;--app-height&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHeight&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;px`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;resize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;appHeight&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;appHeight&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;appHeight&lt;/strong&gt; function has sets new style property var(&lt;code&gt;--app-height&lt;/code&gt;) including current window height, &lt;code&gt;--app-height&lt;/code&gt; it is necessary for next steps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="py"&gt;--app-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vw&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--app-height&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the previous step I've created the reference &lt;code&gt;--app-height&lt;/code&gt;, wrapping in the &lt;code&gt;var()&lt;/code&gt; I've received CSS variable &lt;code&gt;var(--app-height)&lt;/code&gt;. This variable is allowed to read values created by JS.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. CSS solution (not recommend)
&lt;/h3&gt;

&lt;p&gt;The last, but not the least solution is &lt;code&gt;--webkit-fill-available&lt;/code&gt;, this solution works only on Apple devices, it won't solve the problem on Android devices. I don't recommend this solution, but it's worth showing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;webkit-fill-available&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for your attention! I’ll appreciate your feedback.&lt;/p&gt;

&lt;p&gt;If you like this article, follow me on Twitter &lt;a href="https://twitter.com/MaciejDEV" rel="noopener noreferrer"&gt;@MaciejDEV&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>mobile</category>
      <category>css</category>
      <category>ios</category>
    </item>
    <item>
      <title>How to sort an array of strings with non-latin letters?</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Sat, 12 Dec 2020 13:28:36 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/how-to-sort-an-array-of-strings-with-non-latin-letters-1710</link>
      <guid>https://dev.to/maciejtrzcinski/how-to-sort-an-array-of-strings-with-non-latin-letters-1710</guid>
      <description>&lt;p&gt;JavaScript has a native sort method, you can do it with array.sort(), it will sort the array alphabetically. Also, you can provide your custom sorting functionality.&lt;/p&gt;


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


&lt;p&gt;But if you want to order an array of non-ASCII character like [‘ą’, ‘ę’, ‘ó’, ‘ż’, ‘ź’, ‘e’], you will receive a [“e”, “ó”, “ą”, “ę”, “ź”, “ż”]. That happened because sort function works only with the English alphabet.&lt;/p&gt;


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


&lt;p&gt;Fortunately, there are two ways to overcome this behavior &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator" rel="noopener noreferrer"&gt;localeCompare&lt;/a&gt; and Intl.Collator provided by ECMAScript Internationalization API.&lt;/p&gt;

&lt;h4&gt;
  
  
  Using &lt;code&gt;localeCompare()&lt;/code&gt;
&lt;/h4&gt;


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


&lt;h4&gt;
  
  
  Using &lt;code&gt;Intl.Collator()&lt;/code&gt;
&lt;/h4&gt;


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


&lt;p&gt;So when you are working with arrays of strings in a language different from English, remember to use these methods to avoid unexpected sorting.&lt;/p&gt;

&lt;p&gt;Thank you for your time!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why Object.is() is better than ‘==’ and ‘===’ ?</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Sat, 12 Dec 2020 13:22:47 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/why-object-is-is-better-than-and-5g59</link>
      <guid>https://dev.to/maciejtrzcinski/why-object-is-is-better-than-and-5g59</guid>
      <description>&lt;p&gt;Everybody who used JavaScript knows that JS is loosely typed and comparing with ‘==’ gives unexpected results.&lt;/p&gt;


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


&lt;p&gt;So if we use triple equals operator ‘===’, we got a more strict result, but it is also not yet perfect:&lt;/p&gt;


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


&lt;p&gt;For help us in this case we use ES6 ‘Object.is()’, it is more precision than ‘===’ and moreover it behaves well in some special cases:&lt;/p&gt;


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


&lt;h4&gt;
  
  
  Compare table:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2ve2gf8hs62te46ror6v.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2ve2gf8hs62te46ror6v.jpeg" alt="Table" width="800" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Polyfill:
&lt;/h4&gt;


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


&lt;p&gt;If you like this article, follow me on Twitter &lt;a href="https://twitter.com/MaciejDEV" rel="noopener noreferrer"&gt;@MaciejDEV&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>objectis</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why you should motivate your Pull Request?</title>
      <dc:creator>Maciej Trzciński 🌱🇵🇱</dc:creator>
      <pubDate>Sat, 12 Dec 2020 13:14:08 +0000</pubDate>
      <link>https://dev.to/maciejtrzcinski/why-you-should-motivate-your-pull-request-2l1p</link>
      <guid>https://dev.to/maciejtrzcinski/why-you-should-motivate-your-pull-request-2l1p</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzc08f9jiaz3yws3vfty7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzc08f9jiaz3yws3vfty7.png" alt="PR Description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every programmer uses GitHub or another Git repository, If you didn’t use Git repository, read about it. A good PR description is a clue in communication. You don’t want to spend a couple of hours at PR for only understanding your colleague code. Another good example is when you back to the issue after a few days or weeks, this description will let you back to your work in a few minutes, not hours.&lt;br&gt;
Here it’s my recommendation for the PR description.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## Description
This PR will resolve nested lists compiled from markdown. Solution description
## Solution description
In the HtmlRender component I imported a new component `List` where I implemented methods and CSS for the nested list, in the past, we did not have any implementation for List. I discussed with our Designer [here it’s the link for this conversation] and we added square dots for the list, and small numbers for the ordered list. In the List component, I created two methods: one for unordered lists named unorderedList and orderedList for ordered lists.
## Jira ticket
https://[team].atlassian.net/jira/software/projects/[project]/boards/selectedIssue=[issue]
## Did you test this issue on all browsers?
[x] Chrome
[x] FireFox
[x] Edge
[x] Safari
[x] Mobile Safari/Chrome
[x] Tablet Safari/Chrome
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Description
&lt;/h2&gt;

&lt;p&gt;At this place, the author of Pull Request should describe in a few words problem, what an author wants to resolve in this PR. You should type max 2/3 paragraphs. It must be short but valuable. It’s no place for essays, reviewers, another colleague or you must easily understand what did you want to resolve here.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;This PR will resolve nested lists compiled from markdown.Solution description
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution description
&lt;/h2&gt;

&lt;p&gt;This is a place where you should describe your steps, what you added, changed, or removed. Solution description is like a journal where you will describe your steps or explain your idea.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In the HtmlRender component I imported a new component `List` where I implemented methods and CSS for the nested list. In the past, we did not have any implementation for List. I discussed with our Designer [here it’s the link for this conversation] and we added square dots for the list, and small numbers for the ordered list. In the List component, I created two methods: one for unordered lists named unorderedList and orderedList for ordered lists.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Jira ticket
&lt;/h2&gt;

&lt;p&gt;Here add a link to the ticket, if you don’t have Jira add to another one service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Did you test this issue on all browsers?
&lt;/h2&gt;

&lt;p&gt;This is a place for a checklist. If you don’t test on the web, add another list.&lt;/p&gt;

&lt;p&gt;Thank you for your attention! I’ll appreciate your feedback.&lt;/p&gt;

</description>
      <category>github</category>
      <category>pullrequest</category>
      <category>pr</category>
      <category>git</category>
    </item>
  </channel>
</rss>
