<?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: JavaScript Room</title>
    <description>The latest articles on DEV Community by JavaScript Room (@room_js).</description>
    <link>https://dev.to/room_js</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F86814%2Fc7b6ca6c-ee9c-4966-aa4f-66f8001d8fbc.png</url>
      <title>DEV Community: JavaScript Room</title>
      <link>https://dev.to/room_js</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/room_js"/>
    <language>en</language>
    <item>
      <title>Building Reddit Game with Devvit and TypeScript (starter included)</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Sat, 08 Nov 2025 18:05:54 +0000</pubDate>
      <link>https://dev.to/room_js/building-reddit-game-with-devvit-and-typescript-starter-included-3kcp</link>
      <guid>https://dev.to/room_js/building-reddit-game-with-devvit-and-typescript-starter-included-3kcp</guid>
      <description>&lt;p&gt;Hey everyone,&lt;br&gt;
I've recently built &lt;a href="https://www.reddit.com/r/investorean/comments/1o5jez6/stock_blitz_guess_tickers_rule_wall_street/" rel="noopener noreferrer"&gt;the simple quiz game&lt;/a&gt; on Reddit and want to share my experience and things I learned on the way.&lt;/p&gt;

&lt;p&gt;This is my take on Reddit games on Youtube, in case you prefer a video format:&lt;/p&gt;

&lt;p&gt;

  &lt;iframe src="https://www.youtube.com/embed/p3eKGK8Lodw"&gt;
  &lt;/iframe&gt;


&lt;/p&gt;

&lt;h2&gt;
  
  
  First of all, what is the Reddit Games?
&lt;/h2&gt;

&lt;p&gt;They exist for years I believe, but for some reason many people don't know about them and I actually found out only recently too. It's an ecosystem on Reddit that includes their native hosting for web apps and proprietary framework called Devvit.js. So you can build full scale applications and games and host them for free on Reddit. Also, you can even receive in-app payments, and this is why I think it's still undervalued. I believe it will grow, but right now it looks like it's still early to enter the ecosystem. So in case you're interested keep reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  A couple of words about Devvit
&lt;/h2&gt;

&lt;p&gt;This is a framework built by the Reddit's team. You write an app with TypeScript or JavaScript, and it's ultimately running on Node.js on their servers. So you don't have any costs, just push your app and Reddit will host both frontend and backend for you.&lt;/p&gt;

&lt;p&gt;There are two types of apps you can build: &lt;strong&gt;Blocks&lt;/strong&gt; and &lt;strong&gt;Web&lt;/strong&gt;. I only used Blocks so far. You write React/HTML-like syntax, but with custom HTML tags provided by Devvit (&lt;a href="https://youtu.be/p3eKGK8Lodw?si=UNZl33EBnHpaV5Tf" rel="noopener noreferrer"&gt;this is how you integrate it with you linter and transpiler&lt;/a&gt;) Blocks are very much limited and not an option for large/complex apps I'd say. But it's running automatically in the feed, and users don't have to launch it. For simple games and apps it might be just enough. I see much more emphasis on the Web, which was released not that long ago. With Web you build a standalone web application with a framework/library of your choice (React, Vue, Angular or any other). You have the backend part and the frontend part. For both types of apps you can access user data and use internal Redis storage to persist any data you need.&lt;/p&gt;

&lt;p&gt;Here's quick comparison of Block and Web:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Devvit Blocks&lt;/th&gt;
&lt;th&gt;Devvit Web&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Interactive In-feed&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reddit Design System&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cross-platform (iOS/Android/Web)&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full Screen / Focus Mode&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sounds&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3D Graphics&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Animations&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard Web Stack&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Need to start Blocks app quickly?
&lt;/h2&gt;

&lt;p&gt;I have built a minimalistic starter repo for Blocks app. It uses TypeScript and Biome.js instead of ESLint which is used in their original starter. Feel free to give it a try!&lt;/p&gt;

&lt;p&gt;Starter: &lt;a href="https://github.com/room-js/reddit-game-blocks-starter/" rel="noopener noreferrer"&gt;https://github.com/room-js/reddit-game-blocks-starter/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have any questions or ideas, please leave a comment.&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
    </item>
    <item>
      <title>GraphQL schema - sharing Input and Output types structure</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Mon, 24 Apr 2023 17:06:30 +0000</pubDate>
      <link>https://dev.to/room_js/graphql-schema-sharing-input-and-output-types-structure-11b4</link>
      <guid>https://dev.to/room_js/graphql-schema-sharing-input-and-output-types-structure-11b4</guid>
      <description>&lt;p&gt;Hey GraphQL experts, I have a question for you: how do you achieve re-use of the schema fields when you need to have the same structure in the Input type and the Output?&lt;/p&gt;

&lt;p&gt;Let's examine this code (GraphQL schema):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="k"&gt;input&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;myInput&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;span class="n"&gt;field1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;field2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&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;span class="k"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;myOutput&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;span class="n"&gt;field1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;field2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&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;p&gt;Is there any way to re-use the structure here? I've tried to make use of fragments and &lt;code&gt;extends&lt;/code&gt; functionality but nothing worked so far.&lt;/p&gt;

&lt;p&gt;Is it possible to achieve that and how would you approach it?&lt;/p&gt;

&lt;p&gt;TIA!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>question</category>
      <category>graphql</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Dependabot: what is your favorite configuration (approach)?</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Mon, 19 Jul 2021 11:42:10 +0000</pubDate>
      <link>https://dev.to/room_js/dependabot-what-is-your-favorite-configuration-approach-5hah</link>
      <guid>https://dev.to/room_js/dependabot-what-is-your-favorite-configuration-approach-5hah</guid>
      <description>&lt;p&gt;Hello everyone! You probably well know and often use &lt;a href="https://dependabot.com/"&gt;Dependabot&lt;/a&gt; in your projects. It's quite nice tool for automating the management of a project dependencies. I also use it on many Github repositories I manage. And recently I started noticing that I spend quite some time to manage the PRs. Dependabot can easily overwhelm you with the auto-generated PRs. Especially if you manage many repositories.&lt;/p&gt;

&lt;p&gt;My typical config is quite simple right now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .github/dependabot.yml&lt;/span&gt;

&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;span class="na"&gt;updates&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;package-ecosystem&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm&lt;/span&gt;
    &lt;span class="na"&gt;directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/"&lt;/span&gt;
    &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;daily&lt;/span&gt;
    &lt;span class="na"&gt;commit-message&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;prefix&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[skip&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;ci]:&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I was wondering what hacks do you guys use in your routine? Maybe you have found a nice approach here? Please share it if so! Thank you all in advance!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>github</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
    <item>
      <title>Deleting all S3 buckets in a single CLI command</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Sun, 06 Jun 2021 09:32:02 +0000</pubDate>
      <link>https://dev.to/room_js/deleting-all-s3-buckets-in-a-single-cli-command-fdm</link>
      <guid>https://dev.to/room_js/deleting-all-s3-buckets-in-a-single-cli-command-fdm</guid>
      <description>&lt;p&gt;Hi everyone!&lt;br&gt;
This is more like a cheatsheet for myself, but maybe it will be also helpful for someone else. If you use AWS S3 storage service you probably have noticed that you cannot remove not empty buckets straight away via website, you have to clean up the content first. And then, when you have a bunch of buckets you want to delete, it's a bit of pain to remove them one by one via the AWS website interface. AWS command line interface can save us some time here. Don't forget to &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html"&gt;install it&lt;/a&gt; and &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"&gt;configure your credentials&lt;/a&gt;. Then you can use the commands below in your terminal.&lt;/p&gt;

&lt;h4&gt;
  
  
  Delete all S3 buckets stored in your AWS account (including not empty):
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;aws s3 ls | cut -d" " -f 3 | xargs -I{} aws s3 rb s3://{} --force
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Delete only empty buckets (without &lt;code&gt;--force&lt;/code&gt; flag):
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;aws s3 ls | cut -d" " -f 3 | xargs -I{} aws s3 rb s3://{}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Delete only buckets with the prefix &lt;code&gt;old_&lt;/code&gt;:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;aws s3 ls | grep 'old_*' | cut -d" " -f 3 | xargs -I{} aws s3 rb s3://{} --force
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;If you have any questions or suggestion on the commands don't hesitate to leave a comment below. Have a productive day!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
    <item>
      <title>How to transfer repository from GitLab to GitHub</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Fri, 13 Nov 2020 14:34:54 +0000</pubDate>
      <link>https://dev.to/room_js/how-to-transfer-repository-from-gitlab-to-github-15fi</link>
      <guid>https://dev.to/room_js/how-to-transfer-repository-from-gitlab-to-github-15fi</guid>
      <description>&lt;p&gt;Hello!&lt;br&gt;
If you're curious about migrating repository to GitHub from GitLab or another registry I've recorded a quick demo on that.&lt;br&gt;
I've found 2 possible ways to do that, but only one of them supports both public and private repositories. GitHub has the &lt;code&gt;import&lt;/code&gt; functionality available in UI, but unfortunately, it seems not supporting private repositories so far. Anyway, it's a very easy task to do. Take a look at the video, just 2 minutes... &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Mqc7SajFGtI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Thanks for watching! And please let me know if I've missed something here...&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>gitlab</category>
    </item>
    <item>
      <title>All you need to know about JSON in 5 minutes</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Thu, 04 Jun 2020 11:38:50 +0000</pubDate>
      <link>https://dev.to/room_js/all-you-need-to-know-about-json-in-5-minutes-5fmb</link>
      <guid>https://dev.to/room_js/all-you-need-to-know-about-json-in-5-minutes-5fmb</guid>
      <description>&lt;p&gt;Hi! I've never thought that JSON can be a topic for a standalone tutorial/post. But recently I got this suggestion from one of my followers on Instagram and decided to make a quick overview of JSON. I actually think now that it might be useful for some devs. So I recorded the 5 minutes video:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/ut2Pw2tS7Ek"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You also can get through the points by yourself, it's not difficult for understanding anyway. Let's write it down:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSON&lt;/strong&gt; (JavaScript Object Notation) is a lightweight format for storing and transporting data. It's heavily used on modern web.&lt;/p&gt;

&lt;h2&gt;
  
  
  Syntax
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;File extension is ".json"&lt;/li&gt;
&lt;li&gt;Root element must be an object or an array&lt;/li&gt;
&lt;li&gt;All keys must be double-quoted&lt;/li&gt;
&lt;li&gt;String values must be double-quoted (escape double quotes in the value)&lt;/li&gt;
&lt;li&gt;Number and boolean values must NOT be double-quoted&lt;/li&gt;
&lt;li&gt;Comments are not supported by design&lt;/li&gt;
&lt;li&gt;No trailing commas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A browser's environment, as well as Node.js, has the global object &lt;code&gt;JSON&lt;/code&gt; working with this format. Basically, you need to know just two its methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;JSON.parse(argument)&lt;/code&gt;: string -&amp;gt; object/array&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;JSON.stringify(argument)&lt;/code&gt;: object/array -&amp;gt; string
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// examples&lt;/span&gt;
&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;key&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;value&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// { key: "value" }&lt;/span&gt;
&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;value&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;//"{"key":"value"}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;






&lt;p&gt;That's what you need to know about JSON. Did I miss something important? Please let me know in comments then.&lt;/p&gt;

&lt;p&gt;Thanks for watching/reading and welcome to &lt;strong&gt;JavaScript Room&lt;/strong&gt; blog on  &lt;a href="https://www.instagram.com/room_js"&gt;Instagram&lt;/a&gt;, &lt;a href="https://twitter.com/room_js"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.facebook.com/roomjs"&gt;Facebook&lt;/a&gt; and &lt;a href="https://t.me/room_js"&gt;Telegram&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Node.js: Migration from JavaScript to TypeScript</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Sat, 30 May 2020 10:26:07 +0000</pubDate>
      <link>https://dev.to/room_js/node-js-migration-from-javascript-to-typescript-379l</link>
      <guid>https://dev.to/room_js/node-js-migration-from-javascript-to-typescript-379l</guid>
      <description>&lt;p&gt;Hi! I've recorded a small tutorial about migration a small Node.js application to TypeScript. If you're not familiar with TS yet but want to migrate an existing project, you may find this video helpful.&lt;/p&gt;

&lt;p&gt;P.S. It's not difficult, at all... :)&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/qFMMOJucqTw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Thanks for watching! Any feedback is appreciated!&lt;/p&gt;

&lt;p&gt;Follow JavaScript Room blog on Instagram: &lt;a href="https://www.instagram.com/room_js"&gt;https://www.instagram.com/room_js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>(Another) TypeScript starter for Chrome extensions</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Thu, 28 May 2020 10:08:12 +0000</pubDate>
      <link>https://dev.to/room_js/another-typescript-starter-for-chrome-extensions-2g3p</link>
      <guid>https://dev.to/room_js/another-typescript-starter-for-chrome-extensions-2g3p</guid>
      <description>&lt;p&gt;Hi, everyone! I've recently built &lt;a href="https://chrome.google.com/webstore/detail/jphfcmjmlcoecehbanbbfgonpapcnjdi" rel="noopener noreferrer"&gt;the small Chrome extension for LinkedIn&lt;/a&gt; (it's open-sourced and &lt;a href="https://github.com/yurist38/linkedin-video-downloader" rel="noopener noreferrer"&gt;available on GitHub&lt;/a&gt;). When I just decided to make it, I took a look at available starters. I found some but they didn't fit my needs, so I configured the project from scratch. And after that, I thought that it might be useful to make a standalone starter, so I (or you) can quickly bootstrap a new Chrome extension next time. I even recorded the video with a quick overview for people who are completely new to the stack.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/01vp9cYbQus"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Here is the starter itself
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/room-js" rel="noopener noreferrer"&gt;
        room-js
      &lt;/a&gt; / &lt;a href="https://github.com/room-js/chrome-extension-ts-starter" rel="noopener noreferrer"&gt;
        chrome-extension-ts-starter
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Chrome Extension starter built with TypeScript
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;chrome-extension-ts-starter&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;It is a boilerplate for a Chrome Extension built with TypeScript and Parcel.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;This starter consists of the following parts&lt;/h2&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Background script (vanilla TS)&lt;/li&gt;
&lt;li&gt;Content script (vanilla TS)&lt;/li&gt;
&lt;li&gt;Options page (Vue.js, Sass)&lt;/li&gt;
&lt;li&gt;Popup page (Vue.js, Sass)&lt;/li&gt;
&lt;li&gt;DevTools panel page (React.js, Styled Components)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;And, of course, the &lt;code&gt;./manifest.json&lt;/code&gt; file describing its configuration.&lt;/em&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Environment&lt;/h2&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Node.js &amp;gt;=12.0.0&lt;/li&gt;
&lt;li&gt;NPM &amp;gt;= 6.0.0&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Most probably it will work with earlier versions too but I didn't test it.&lt;/em&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Testing&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;&lt;code&gt;Jest&lt;/code&gt; is included and ready for the vanilla TS parts. Testing for React/Vue is not included in order to keep the Jest config clean.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Scripts&lt;/h2&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;npm run dist&lt;/code&gt; - build the extension into &lt;code&gt;./dist&lt;/code&gt; folder&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm run lint&lt;/code&gt; - ESLint for &lt;code&gt;.ts&lt;/code&gt; and &lt;code&gt;.tsx&lt;/code&gt; files&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm run test&lt;/code&gt; - Jest unit tests&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/room-js/chrome-extension-ts-starter" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;





&lt;p&gt;Also, I wanted to share with you some nice stuff that I've found just yesterday. &lt;a href="https://github.com/bumble-org" rel="noopener noreferrer"&gt;These guys at Bumble&lt;/a&gt; are doing a great job around Chrome extensions. Take a look at the packages they have published. You might also find them useful for building extensions.&lt;/p&gt;




&lt;p&gt;Thanks for reading/viewing! Feel free to star the repo and follow &lt;a href="https://www.instagram.com/room_js" rel="noopener noreferrer"&gt;JavaScript Room blog on Instagram&lt;/a&gt;.&lt;br&gt;
Have a great time and stay safe!&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>react</category>
      <category>vue</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Gatsby.js starter with light/dark themes based on CSS variables (TypeScript)</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Mon, 02 Mar 2020 22:23:44 +0000</pubDate>
      <link>https://dev.to/room_js/gatsby-js-starter-with-light-dark-themes-based-on-css-variables-typescript-38pe</link>
      <guid>https://dev.to/room_js/gatsby-js-starter-with-light-dark-themes-based-on-css-variables-typescript-38pe</guid>
      <description>&lt;p&gt;Hello, all my dear JAMStack'ers! If you are opened this post you might be feeling as much excited as me when working with modern static website generators. They are becoming so powerful! And Gatsby.js is definitely somewhere at the top of the list now. It works on React.js, has a large ecosystem and pretty descriptive docs. So more and more devs are trying it out. If you're one of them, I have something for you! Today I'd like to share with you my fresh Gatsby.js starter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it includes:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript support&lt;/li&gt;
&lt;li&gt;Light and Dark themes based on CSS variables (persisted state)&lt;/li&gt;
&lt;li&gt;Font Awesome&lt;/li&gt;
&lt;li&gt;Normalize.css&lt;/li&gt;
&lt;li&gt;Styling is done with CSS Modules&lt;/li&gt;
&lt;li&gt;SASS support (for both: global styles and CSS Modules)&lt;/li&gt;
&lt;li&gt;ESLint for linting TS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I made it simple and based on the default starter. Not much styling, nothing extra, all is in your hands...&lt;/p&gt;

&lt;h2&gt;
  
  
  How it looks like:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7q_9R_Dm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/aj4h1udbzwiiq2bkee4w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7q_9R_Dm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/aj4h1udbzwiiq2bkee4w.gif" alt="Starter Preview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Live demo is available here:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://gatsby-starter-typescript-themes.netlify.com/"&gt;gatsby-starter-typescript-themes.netlify.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub repository:
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/room-js"&gt;
        room-js
      &lt;/a&gt; / &lt;a href="https://github.com/room-js/gatsby-starter-typescript-themes"&gt;
        gatsby-starter-typescript-themes
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Starter for Gatsby.js with TypeScript and light &amp;amp; dark themes
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
gatsby-starter-typescript-themes&lt;/h1&gt;
&lt;p&gt;A Gatsby starter based on the &lt;a href="https://github.com/gatsbyjs/gatsby-starter-default"&gt;gatsby-starter-default&lt;/a&gt; with TypeScript support and Light/Dark themes based on CSS variables.&lt;/p&gt;
&lt;h2&gt;
Includes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;CSS Modules&lt;/li&gt;
&lt;li&gt;SASS (for both: global styles and CSS Modules)&lt;/li&gt;
&lt;li&gt;Light and Dark themes based on CSS variables.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Preview&lt;/h2&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://raw.githubusercontent.com/room-js/gatsby-starter-typescript-themes/master/preview.gif"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lGJ5v_NK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://raw.githubusercontent.com/room-js/gatsby-starter-typescript-themes/master/preview.gif" alt="Preview"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
How to use&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a Gatsby site.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Use the Gatsby CLI to create a new site, specifying the starter.&lt;/p&gt;
&lt;div class="highlight highlight-source-shell"&gt;&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; create a new Gatsby site using the starter&lt;/span&gt;
gatsby new my-themed-starter https://github.com/room-js/gatsby-starter-typescript-themes&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Start developing.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Navigate into your new site’s directory and start it up.&lt;/p&gt;
&lt;div class="highlight highlight-source-shell"&gt;&lt;pre&gt;&lt;span class="pl-c1"&gt;cd&lt;/span&gt; my-themed-starter/
gatsby develop&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Open the source code and start editing!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Your site is now running at &lt;code&gt;http://localhost:8000&lt;/code&gt;!&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: You'll also see a second link: &lt;em&gt;&lt;code&gt;http://localhost:8000/___graphql&lt;/code&gt;&lt;/em&gt;. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the &lt;a href="https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql" rel="nofollow"&gt;Gatsby tutorial&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Open the &lt;code&gt;my-themed-starter&lt;/code&gt; directory in your code editor of choice and edit &lt;code&gt;src/pages/index.js&lt;/code&gt;. Save…&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/room-js/gatsby-starter-typescript-themes"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  How to create a new project:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install Gatsby CLI: &lt;code&gt;npm install -g gatsby-cli&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a new project from this starter: &lt;code&gt;gatsby new my-themed-starter https://github.com/room-js/gatsby-starter-typescript-themes&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Thank you for reading!&lt;br&gt;
If you like the starter I kindly ask you to star the GitHub repo and like the post! Also, if you got any questions about it, please let me know in the comments.&lt;/p&gt;

&lt;p&gt;Read &lt;strong&gt;JavaScript Room&lt;/strong&gt; blog on Instagram: &lt;a href="https://instagram.com/room_js"&gt;@room_js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How do YOU speed up Docker (Compose) on Mac?</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Tue, 10 Dec 2019 18:35:17 +0000</pubDate>
      <link>https://dev.to/room_js/how-do-you-speed-up-docker-compose-on-mac-2aj2</link>
      <guid>https://dev.to/room_js/how-do-you-speed-up-docker-compose-on-mac-2aj2</guid>
      <description>&lt;p&gt;Hey everyone!&lt;/p&gt;

&lt;p&gt;As I see, the performance of &lt;code&gt;docker&lt;/code&gt;/&lt;code&gt;docker-compose&lt;/code&gt; is a pain point for many developers and devops folks. I'm on the list, for sure. I still have Docker Compose running super slow on my fresh Mac Air.&lt;/p&gt;

&lt;p&gt;How about you? Are you okay with your Docker's performance? And what tricks helped you to configure it nicely?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>devops</category>
      <category>docker</category>
    </item>
    <item>
      <title>Creating a custom widget for Netlify CMS</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Fri, 06 Dec 2019 12:05:40 +0000</pubDate>
      <link>https://dev.to/room_js/create-a-custom-widget-for-netlify-cms-4gl9</link>
      <guid>https://dev.to/room_js/create-a-custom-widget-for-netlify-cms-4gl9</guid>
      <description>&lt;p&gt;Hi, devs!&lt;/p&gt;

&lt;p&gt;Today I would like to share a few things I've found recently working with Netlify CMS. This CMS has a set of built-in fields,  that you can use in your schema. Those fields are called "widgets" in the Netlify CMS ecosystem. Each widget describes the specific entry data type. For example, there are widgets &lt;code&gt;Date&lt;/code&gt;, &lt;code&gt;Text&lt;/code&gt;, &lt;code&gt;Boolean&lt;/code&gt;, etc. You can find all available widgets in &lt;a href="https://www.netlifycms.org/docs/widgets" rel="noopener noreferrer"&gt;the official docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Most of the time, you probably will be fine with these built-in widgets. But it's also nice to look forward and think in advance, what if someday I need more functionality than the original widgets provide? Luckily, authors of Netlify CMS thought of this also and made it possible to create and register a custom widget. Moreover, you even can find a few articles that show and explain how to do that. But, all of them weren't clear enough for me, they are hiding quite important details of the implementation. So I had to read all of the articles to make it work. So the goal of this post is putting all of the important things together.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you are not interested in further reading and want to see the actual code, you can directly go to the &lt;a href="https://codesandbox.io/s/nifty-black-s8eih" rel="noopener noreferrer"&gt;demo on codesandbox&lt;/a&gt; or &lt;a href="https://github.com/room-js/netlify-cms-custom-widget" rel="noopener noreferrer"&gt;github repo&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's write some code
&lt;/h2&gt;

&lt;p&gt;A custom widget consists of two different React.js components: "control" and "preview". The first one is taking input from a user and the second one is responsible for how the user input data will be rendered in the preview area. As far as I understood, the preview component is optional and if you don't have it the data will be rendered in the preview anyway, but you have no control over the styling in this case.&lt;/p&gt;

&lt;p&gt;So, let's start with writing these two React.js components.&lt;/p&gt;

&lt;p&gt;I made the "control" component based on &lt;code&gt;CKEditor&lt;/code&gt;, which is a rich text editor (similar to built-in &lt;code&gt;Markdown&lt;/code&gt; widget).&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;// Control component - src/components/customWidget/CustomWidgetControl.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PureComponent&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;CKEditor&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@ckeditor/ckeditor5-react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ClassicEditor&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@ckeditor/ckeditor5-build-classic&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CustomWidgetControl&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;PureComponent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;onChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;editor&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;editor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;CKEditor&lt;/span&gt;
        &lt;span class="nx"&gt;editor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ClassicEditor&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  The important things about the control component:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;It CAN NOT be a functional component (React.FC)&lt;/strong&gt;. If you make it FC it will not save data for some reason, so be aware of it.&lt;/li&gt;
&lt;li&gt;You need to update the stored data manually. For this, the control component has a prop &lt;code&gt;onChange&lt;/code&gt; that receives the new value as a parameter. We need to call this prop on every change.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Preview component - src/components/customWidget/CustomWidgetPreview.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CustomWidgetPreview&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&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="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;dangerouslySetInnerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;__html&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;What we need to know here is just that &lt;strong&gt;we get the value from the component's props&lt;/strong&gt;. In this case, we get the HTML string and render it as a raw HTML.&lt;/p&gt;
&lt;h3&gt;
  
  
  Register the widget
&lt;/h3&gt;

&lt;p&gt;So, we have created components for our custom widget. Now we need to introduce this widget to Netlify CMS, make it visible for it. Talking by Netlify CMS' terminology, we have to register our widget.&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;// src/cms/cms.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;CMS&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;netlify-cms-app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;CustomWidgetControl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;CustomWidgetPreview&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../components/customWidget&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;CMS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerWidget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mywidget&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;CustomWidgetControl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;CustomWidgetPreview&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;registerWidget()&lt;/code&gt; method accepts three arguments: widget name, control component and preview component. The last one is optional as I mentioned above.&lt;/p&gt;

&lt;p&gt;Make sure that the JavaScript file with this code is injected into the CMS pages. In this particular case, it's done by &lt;code&gt;gatsby-plugin-netlify-cms&lt;/code&gt; plugin, but it very depends on how you use Netlify CMS.&lt;/p&gt;
&lt;h3&gt;
  
  
  Add the field to your schema
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;// static/admin/config.yml&lt;/span&gt;
&lt;span class="nn"&gt;...&lt;/span&gt;
    &lt;span class="na"&gt;fields&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Title"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;title"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;string"&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;My&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Custom&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Widget"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mywidgetname"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;widget&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mywidget"&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;

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

&lt;/div&gt;

&lt;h3&gt;
  
  
  Recap
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Control component can not be a function&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;onChange&lt;/code&gt; prop in control component to update the value&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;value&lt;/code&gt; prop in the preview component to access the input data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope, this article will help you and save your time on research. Please let me know in comments if something stays unclear to you.&lt;/p&gt;
&lt;h1&gt;
  
  
  Source code / Demo
&lt;/h1&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/room-js" rel="noopener noreferrer"&gt;
        room-js
      &lt;/a&gt; / &lt;a href="https://github.com/room-js/netlify-cms-custom-widget" rel="noopener noreferrer"&gt;
        netlify-cms-custom-widget
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Small demo to show how to create a custom widget for Netlify CMS
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;netlify-cms-custom-widget&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;Small demo to show how to create a custom widget for Netlify CMS&lt;/p&gt;

&lt;p&gt;The custom widget components are located in &lt;code&gt;./src/components/customWidget&lt;/code&gt; folder.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Live demo on CodeSandbox&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/s/nifty-black-s8eih?fontsize=14&amp;amp;hidenavigation=1&amp;amp;theme=dark" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/ecd139ba9847d0c77607c86339eb8ee6939ca85143a92ae16ebf20f58325e1b6/68747470733a2f2f636f646573616e64626f782e696f2f7374617469632f696d672f706c61792d636f646573616e64626f782e737667" alt="Edit nifty-black-s8eih"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/room-js/netlify-cms-custom-widget" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/nifty-black-s8eih"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>5 news portals for web developers</title>
      <dc:creator>JavaScript Room</dc:creator>
      <pubDate>Mon, 28 Oct 2019 13:34:00 +0000</pubDate>
      <link>https://dev.to/room_js/5-news-portals-for-web-developers-33pf</link>
      <guid>https://dev.to/room_js/5-news-portals-for-web-developers-33pf</guid>
      <description>&lt;p&gt;Hi, devs! A web developer's environment is rapidly changing, we all know that. That's why it's very important to stay in sync with recent updates and changes around the programming world. Today I'd like to share five resources I've found useful to get fresh news and updates from. Let's quickly go through them all:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;a href="https://www.webdesignernews.com"&gt;WebDesignerNews.com&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This portal is collecting design and dev news on the main page and split them also into different categories so you can easier find what you need. My favorite category is &lt;a href="https://www.webdesignernews.com/category/web-development"&gt;webdev&lt;/a&gt; but you might find other categories interesting too. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;a href="https://thenextweb.com"&gt;TheNextWeb.com&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The Next Web&lt;/strong&gt; has mostly tech news of the wide range on its main page. But if you move to the &lt;strong&gt;&lt;a href="https://thenextweb.com/dd/"&gt;Design &amp;amp; Dev&lt;/a&gt;&lt;/strong&gt; section you might find there many interesting articles! Check it out.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;a href="https://hub.packtpub.com/news"&gt;Hub.Packtpub.com/news&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.packtpub.com"&gt;Packt&lt;/a&gt; is quite a famous publishing company, they have released many tech books and keep doing a great job actually! Also, they have a "hub" - website and news portal for programmers. Don't miss it too!&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;a href="https://www.infoworld.com"&gt;InfoWorld.com&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;One more resource with news and updates related to both hardware and software. All the news here are also categorized, for web dev updates please check out the &lt;strong&gt;&lt;a href="https://www.infoworld.com/category/web-development"&gt;Web Development&lt;/a&gt;&lt;/strong&gt; category.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;a href="https://frontendfront.com"&gt;FrontEndFront.com&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The last resource is completely focused on front-end development and posts only articles and news related to it. The blog looks nice and allows you to add your story to it. It looks pretty promising, I personally will keep my eye on this one.&lt;/p&gt;

&lt;p&gt;What do you think about these five websites, do you know/read them? Or maybe you can recommend other good resources? Do not hesitate to put your thoughts in comments, sharing is caring! :) Thanks for reading!&lt;/p&gt;

</description>
      <category>news</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
