<?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: maxam 🧑🏻‍💻</title>
    <description>The latest articles on DEV Community by maxam 🧑🏻‍💻 (@maxam2017).</description>
    <link>https://dev.to/maxam2017</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%2F260499%2F24d9b4af-385a-49c1-a351-d20de7c16348.png</url>
      <title>DEV Community: maxam 🧑🏻‍💻</title>
      <link>https://dev.to/maxam2017</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maxam2017"/>
    <language>en</language>
    <item>
      <title>Rethink React: Is it still a good library?</title>
      <dc:creator>maxam 🧑🏻‍💻</dc:creator>
      <pubDate>Fri, 07 Oct 2022 16:49:18 +0000</pubDate>
      <link>https://dev.to/maxam2017/rethink-react-is-it-still-a-good-library-28oc</link>
      <guid>https://dev.to/maxam2017/rethink-react-is-it-still-a-good-library-28oc</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;About 4 years ago, I started to write React as my first choice in frontend development. However, time changes. Something better comes out already…&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the beginning, I was a React lover because it was much more elegant than other frameworks/libraries at that time. Declarative UI (and JSX, a syntax sugar 🍬 for UI), Virtual DOM, and one-way data flow… those things are fascinating to me, also the ecosystem and community. However, I feel disappointed with it now.&lt;/p&gt;




&lt;p&gt;below we will discuss two parts of React: "&lt;strong&gt;Performance&lt;/strong&gt;" and "&lt;strong&gt;Stability&lt;/strong&gt;".&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://reactjs.org/docs/faq-internals.html#what-is-the-virtual-dom"&gt;Virtual DOM in React&lt;/a&gt; is a lie because runtime diffing really hurts performance.&lt;/p&gt;

&lt;p&gt;The concept of how declarative UI works in React is powered by virtual DOM. It’s a plain object for storing something about rending (Idk its structure really looks like but I think it changes after React Fiber comes out) and React does "&lt;a href="https://reactjs.org/docs/reconciliation.html"&gt;reconciliation&lt;/a&gt;" for synchronizing real DOM with it.&lt;/p&gt;

&lt;p&gt;The official docs only show some points about how heuristic the process is. But for me, it really a black box because I never get into the source code. But it doesn’t matter. The problem isn’t about the algorithm behind it. It’s about why React does it &lt;strong&gt;in the runtime&lt;/strong&gt; instead of build time (some frameworks already do &lt;a href="https://svelte.dev/blog/virtual-dom-is-pure-overhead"&gt;that&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Stability
&lt;/h2&gt;

&lt;p&gt;React is too &lt;em&gt;REACTIVE&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Except for built-in reconciliation, React provides 2 ways to mitigate re-render.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;builtin hooks: &lt;a href="https://reactjs.org/docs/hooks-reference.html#usememo"&gt;useMemo&lt;/a&gt;, &lt;a href="https://reactjs.org/docs/hooks-reference.html#usecallback"&gt;useCallback&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://reactjs.org/docs/react-api.html#reactmemo"&gt;React.memo&lt;/a&gt; / &lt;a href="https://reactjs.org/docs/react-component.html#shouldcomponentupdate"&gt;shouldComponentUpdate&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To be honest, it’s bad and costs a lot. If you want they don’t re-render, you need to wrap variables, functions, or components with one more function and make more diffing.&lt;/p&gt;

&lt;p&gt;Not only make DX worse but also that comparison (diffing) makes your application slower 🐢.&lt;/p&gt;

&lt;p&gt;I think the React team already notice the first problem and run the project: React Forget to rescue our DX. If you want to know more about this project, watch the playback of React Conf 2021: &lt;a href="https://www.youtube.com/watch?v=lGEMwh32soc"&gt;React without Memo - YouTube&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;As I see it, the root cause of those problems is the philosophy of React. For example, one of the modern frontend frameworks, &lt;a href="https://svelte.dev/"&gt;Svelte&lt;/a&gt;, gives a better solution:&lt;/p&gt;

&lt;p&gt;No virtual DOM: compiling your code into tiny vanilla js&lt;br&gt;
Reactive on your own: non-reactive by default and mark it if you want.&lt;br&gt;
And I really fond of the concept: Don’t let everything be reactive.&lt;/p&gt;

&lt;p&gt;Maybe React won’t change now, and I still need to use React at work. However, React 18 still impresses me with the new features like streaming SSR and selective hydration. I’m still waiting for React Forget and other new features to come out.&lt;/p&gt;

&lt;p&gt;Give this post &lt;strong&gt;like&lt;/strong&gt; 💖 and my blog a &lt;strong&gt;follow&lt;/strong&gt; if you enjoyed this post and want to see more.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Add a New GitHub SSH Key Automatically 🔑</title>
      <dc:creator>maxam 🧑🏻‍💻</dc:creator>
      <pubDate>Sun, 02 Oct 2022 13:53:15 +0000</pubDate>
      <link>https://dev.to/maxam2017/add-a-new-github-ssh-key-automatically-32d8</link>
      <guid>https://dev.to/maxam2017/add-a-new-github-ssh-key-automatically-32d8</guid>
      <description>&lt;p&gt;Every time you get a new machine and want to connect GitHub with SSH, it's so annoying to set up. Generate the SSH key after googling for a while and then manually copy &amp;amp; paste it to GitHub on their webpage.&lt;/p&gt;

&lt;p&gt;Is it possible to do this whole process on the command line? Yes!&lt;/p&gt;

&lt;p&gt;Today I'll introduce this brilliant CLI tool - &lt;a href="https://github.com/maxam2017/gh-ssh-keygen"&gt;gh-ssh-keygen&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use &lt;code&gt;gh-ssh-keygen&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;There're two ways available.&lt;/p&gt;

&lt;p&gt;Simply run this command if you don't want to install anything.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/bin/bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/maxam2017/gh-ssh-keygen/HEAD/gh-ssh-keygen.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Otherwise, you can install the whole command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;/bin/bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/maxam2017/gh-ssh-keygen/HEAD/install.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If this command has already been installed, it'll skip or upgrade if the new version is available.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then, run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gh-ssh-keygen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a few interactive steps, SSH key would be added to your GitHub account 🎉&lt;/p&gt;

&lt;p&gt;If you want to know more about how to use it, checkout this video for detail!&lt;br&gt;
&lt;iframe src="https://player.vimeo.com/video/756117951" width="710" height="399"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  How this command works
&lt;/h2&gt;

&lt;p&gt;Internally, it is powered by &lt;a href="https://github.com/cli/cli"&gt;Official GitHub CLI&lt;/a&gt; which provides API to upload ssh keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;gh ssh-key add &lt;span class="o"&gt;[&lt;/span&gt;&amp;lt;key-file&amp;gt;] &lt;span class="o"&gt;[&lt;/span&gt;flags]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Except that, I connect the whole process with the MacOS (and Linux) package manager &lt;code&gt;brew&lt;/code&gt; and OpenSSH auth utils &lt;code&gt;ssh-keygen&lt;/code&gt; together. &lt;/p&gt;

&lt;p&gt;Also, this command handles lots of package installation things and implement some extra validation for user input. Therefore, feel free to use it if you need to add SSH key to your GitHub account next time!&lt;/p&gt;




&lt;p&gt;Welcome to follow me or star ⭐ ️my repo if you're interested in it.&lt;br&gt;
GitHub Repo: &lt;a href="https://github.com/maxam2017/gh-ssh-keygen"&gt;https://github.com/maxam2017/gh-ssh-keygen&lt;/a&gt;&lt;br&gt;
GitHub Account: &lt;a href="https://github.com/maxam2017"&gt;https://github.com/maxam2017&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Are you an early 🐤 or a night 🦉? Let's check out in the Gist</title>
      <dc:creator>maxam 🧑🏻‍💻</dc:creator>
      <pubDate>Fri, 24 Apr 2020 05:27:29 +0000</pubDate>
      <link>https://dev.to/maxam2017/are-you-an-early-or-a-night-let-s-check-out-in-the-gist-1nh7</link>
      <guid>https://dev.to/maxam2017/are-you-an-early-or-a-night-let-s-check-out-in-the-gist-1nh7</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Last week, I build a simple GitHub Action, called &lt;a href="https://github.com/maxam2017/productive-box" rel="noopener noreferrer"&gt;productive-box&lt;/a&gt;. It's my first time creating a GitHub Action so I would like to share some insight about it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The kernel concept about this project is using commit histories to find your most productive hours and declare which type of people you are (simply an early 🐤 or a night 🦉), finally write into your Gist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commit history
&lt;/h2&gt;

&lt;p&gt;When it comes to 'commit', we always think of GitHub. That's right. Here I using GitHub API to access commit history. It's also my first time using it. In the beginning, I check out the v3 RESTful API, but I found something new - v4 GraphQL API, so I gave it a try.&lt;/p&gt;

&lt;p&gt;The greatest part of GitHub GraphQL API is it provides a real-time and interactive playground: GraphQL Explorer which makes a better experience with this new stuff.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1%2AeHICRoedi-p_hEuYHoyPUw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1%2AeHICRoedi-p_hEuYHoyPUw.gif" alt="https://developer.github.com/v4/explorer/"&gt;&lt;/a&gt;&lt;/p&gt;
https://developer.github.com/v4/explorer/



&lt;p&gt;After I completed this project, I knew that GraphQL just means POST a query and gets something you REALLY need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gist
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;reference to an amazing project - matchai/waka-box&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Like him, I also use @octokit/rest, the GitHub REST API client for JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  WorkFlows
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any project on GitHub.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1%2AvlwUwQu65WX13QyzSKRvMA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1400%2F1%2AvlwUwQu65WX13QyzSKRvMA.png"&gt;&lt;/a&gt;&lt;/p&gt;
Easily checkout your workflows in the 'Actions' tab



&lt;p&gt;Simply saying, it uses GitHub's virtual machine to execute our script and we just only need to write YAML config into .github/workflows/xxx.yml.&lt;br&gt;
My Action simply listens to two events: push and schedule. It means that when we push some commits to the master branch(by default) or periodically(just a Linux cron job), it will trigger my built script.&lt;/p&gt;
&lt;h2&gt;
  
  
  Going Forward
&lt;/h2&gt;

&lt;p&gt;I also have some other ideas about this project. Welcome to follow up or star ⭐ ️&lt;a href="https://github.com/maxam2017/productivity-box" rel="noopener noreferrer"&gt;my project&lt;/a&gt; if you're interested in it.&lt;/p&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/maxam2017" rel="noopener noreferrer"&gt;
        maxam2017
      &lt;/a&gt; / &lt;a href="https://github.com/maxam2017/productive-box" rel="noopener noreferrer"&gt;
        productive-box
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Are you an early 🐤 or a night 🦉? Let's check out in gist
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-alert markdown-alert-caution"&gt;
&lt;p class="markdown-alert-title"&gt;Caution&lt;/p&gt;
&lt;p&gt;If you upgrade to v1.1.5+, please remember to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;move the &lt;strong&gt;GIST ID&lt;/strong&gt; to the Secret&lt;/li&gt;
&lt;li&gt;move the &lt;strong&gt;TIMEZONE&lt;/strong&gt; to the Repository variable
For details, refer to the third point in &lt;a href="https://github.com/maxam2017/productive-box/tree/master?tab=readme-ov-file#project-setup" rel="noopener noreferrer"&gt;Project Setup&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;p.s. when you see this notice in the README of your forked repository, it means you have upgraded to v1.1.5&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
  &lt;a href="http://lovera.maxam.now.sh/" rel="nofollow noopener noreferrer"&gt;
    &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F25841814%2F79395484-5081ae80-7fac-11ea-9e27-ac91472e31dd.png" alt="screenshot" width="500"&gt;
  &lt;/a&gt;
  &lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;📌✨productive-box&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;
   &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/8f6e72e25c1c4f591b162817a483b5cb7edcaf8a341493881df61b4bbdf2fbe4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c616e67756167652d747970657363726970742d626c75653f7374796c65"&gt;&lt;img src="https://camo.githubusercontent.com/8f6e72e25c1c4f591b162817a483b5cb7edcaf8a341493881df61b4bbdf2fbe4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c616e67756167652d747970657363726970742d626c75653f7374796c65"&gt;&lt;/a&gt;
   &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/8ce81887ae2837fb99054f07b2aaa9f78b44c6be1bced5fc59dff7d09dc885be/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6178616d323031372f70726f647563746976652d626f78"&gt;&lt;img src="https://camo.githubusercontent.com/8ce81887ae2837fb99054f07b2aaa9f78b44c6be1bced5fc59dff7d09dc885be/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6178616d323031372f70726f647563746976652d626f78"&gt;&lt;/a&gt;
   &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/42982abcd3a7600d7f6011ca937673aff7c633bb4b476bd13c760e407c2b5264/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d6178616d323031372f70726f647563746976652d626f78"&gt;&lt;img src="https://camo.githubusercontent.com/42982abcd3a7600d7f6011ca937673aff7c633bb4b476bd13c760e407c2b5264/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d6178616d323031372f70726f647563746976652d626f78"&gt;&lt;/a&gt;
   &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/ee56b8bf865fcc8426901f1510f74d8c69ee1f1fbb9da876afbe1c46e376608a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d6178616d323031372f70726f647563746976652d626f78"&gt;&lt;img src="https://camo.githubusercontent.com/ee56b8bf865fcc8426901f1510f74d8c69ee1f1fbb9da876afbe1c46e376608a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d6178616d323031372f70726f647563746976652d626f78"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
   Are you an early 🐤 or a night 🦉
   &lt;br&gt;
   When are you most productive during the day?
   &lt;br&gt;
   Let's check out in gist!
&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;This project is inspired by an awesome pinned-gist project.&lt;br&gt;
Find more in &lt;a href="https://github.com/matchai/awesome-pinned-gists" rel="noopener noreferrer"&gt;https://github.com/matchai/awesome-pinned-gists&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Overview&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;This project uses GitHub graphQL API to get the commit histories and write into the gist by &lt;a href="https://github.com/octokit/rest.js#readme" rel="noopener noreferrer"&gt;rest.js&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Setup&lt;/h2&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Prep work&lt;/h3&gt;

&lt;/div&gt;


&lt;ol&gt;

&lt;li&gt;Create a new public GitHub Gist (&lt;a href="https://gist.github.com/" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://gist.github.com/" rel="noopener noreferrer"&gt;https://gist.github.com/&lt;/a&gt;)&lt;/li&gt;

&lt;li&gt;Create a token with the &lt;code&gt;gist&lt;/code&gt; and &lt;code&gt;repo&lt;/code&gt; scope and copy it. (&lt;a href="https://github.com/settings/tokens/new" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://github.com/settings/tokens/new" rel="noopener noreferrer"&gt;https://github.com/settings/tokens/new&lt;/a&gt;)

&lt;blockquote&gt;
&lt;p&gt;enable &lt;code&gt;repo&lt;/code&gt; scope seems &lt;strong&gt;DANGEROUS&lt;/strong&gt;&lt;br&gt;
but this GitHub Action only accesses your commit timestamp…&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&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/maxam2017/productive-box" 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;Feedback welcome! Thanks for reading.&lt;/p&gt;

</description>
      <category>github</category>
      <category>gist</category>
      <category>productivity</category>
      <category>sideprojects</category>
    </item>
  </channel>
</rss>
