<?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: Hunter Chang</title>
    <description>The latest articles on DEV Community by Hunter Chang (@changoman).</description>
    <link>https://dev.to/changoman</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%2F66386%2Fe0232f6f-c5c0-47ae-98b9-3ba363275a4f.jpeg</url>
      <title>DEV Community: Hunter Chang</title>
      <link>https://dev.to/changoman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/changoman"/>
    <language>en</language>
    <item>
      <title>Filtering with React Server Components and URL Search Params</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Thu, 14 Sep 2023 07:55:40 +0000</pubDate>
      <link>https://dev.to/changoman/filtering-with-react-server-components-and-url-search-params-1idd</link>
      <guid>https://dev.to/changoman/filtering-with-react-server-components-and-url-search-params-1idd</guid>
      <description>&lt;p&gt;Traditionally, when you wanted to filter your data using React, you would first store the original data in local state, with the useState hook.&lt;/p&gt;

&lt;p&gt;There would be a useEffect that watches for any filter changes, and then you would re-fetch the data using the applied filters on the client.&lt;/p&gt;

&lt;p&gt;Once you get back the filtered data, you update the useState and the list re-renders, showing only the filtered results.&lt;/p&gt;

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

&lt;p&gt;With the rise of React Server Components in Next.js 13, fetching data happens more and more on the server instead of the client. How can you add filters on the client, but still re-fetch and display the filtered data on the server? Using URL Search Parameters!&lt;/p&gt;

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;00:00 - Intro into the project&lt;/p&gt;

&lt;p&gt;00:56 - Current code setup, using Next.js App router and fetching initial data on the server&lt;/p&gt;

&lt;p&gt;02:20 - Traditional filtering using useState and client side data fetching&lt;/p&gt;

&lt;p&gt;03:14 - Server Actions allow for the filters to be inside a form element, with the action property&lt;/p&gt;

&lt;p&gt;04:01 - Seeing the checkbox filters showing up inside of the server action's function&lt;/p&gt;

&lt;p&gt;04:33 - Using search query parameters, we can re-fetch our filtered data on the server&lt;/p&gt;

&lt;p&gt;05:49 - Constructing the URL search parameters with server actions&lt;/p&gt;

&lt;p&gt;09:00 - We have access to the search parameters from our page.tsx server component&lt;/p&gt;

&lt;p&gt;11:00 - Use the search params to filter our data on the initial server page load&lt;/p&gt;

&lt;p&gt;11:52 - Demo of the search params working with React server components&lt;/p&gt;

&lt;p&gt;12:37 - Make our checkboxes aware of the URL search params, and have them checked by default if the value is in the url&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>servercomponent</category>
    </item>
    <item>
      <title>Link in Bio Website That Feels Like TikTok</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Tue, 29 Aug 2023 07:25:18 +0000</pubDate>
      <link>https://dev.to/changoman/link-in-bio-website-that-feels-like-tiktok-1nkh</link>
      <guid>https://dev.to/changoman/link-in-bio-website-that-feels-like-tiktok-1nkh</guid>
      <description>&lt;p&gt;I recently updated my personal website, &lt;a href="https://hunterchang.com"&gt;https://hunterchang.com&lt;/a&gt;, and wanted to share how I did it. The idea was to make a link in bio type of site, like Linktree, but style it to look and feel like TikTok or Instagram Reels.&lt;/p&gt;

&lt;p&gt;I added full-screen video backgrounds and have my social media icons clearly visible.&lt;/p&gt;

&lt;p&gt;The code can all be found at: &lt;a href="https://github.com/ChangoMan/hchang-reels"&gt;https://github.com/ChangoMan/hchang-reels&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The main slider library I used was &lt;a href="https://swiperjs.com"&gt;https://swiperjs.com&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;1:28 - The site is just mainly 1 HTML page, with some CSS and JavaScript. I didn't think React or a framework was needed for such a simple site.&lt;/p&gt;

&lt;p&gt;1:50 - There is a package.json file that spins up &lt;a href="https://browsersync.io"&gt;https://browsersync.io&lt;/a&gt; and another command that watches for Tailwind CSS changes.&lt;/p&gt;

&lt;p&gt;4:05 - I used &lt;a href="https://swiperjs.com"&gt;https://swiperjs.com&lt;/a&gt; to create the slides for the site. I imported the swiper element bundle and used their web components to make the sliders.&lt;/p&gt;

&lt;p&gt;7:00 - There is a small amount of JavaScript to listen for when the slides change. I needed to know which slide was active, using addEventListener on "realindexchange"&lt;/p&gt;

&lt;p&gt;7:54 - I get the "realIndex" from the event listener and use that to determine which slide I am on.&lt;/p&gt;

&lt;p&gt;8:33 - I didn't want all the background videos to load at once, so I only load the video and include the "source" when I am on that particular slide.&lt;/p&gt;

&lt;p&gt;9:15 - Description of the properties I used on my "video" tag. I took a picture from the first frame of the video and used that as the "poster"&lt;/p&gt;

&lt;p&gt;10:57 - JavaScript that inserts the "source" for each slide, if there is no source detected. This is what triggers the background video to load once you get to the second and third slides.&lt;/p&gt;

</description>
      <category>portfolio</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Next.js App Router Dynamic Sitemap &amp; SEO Metadata</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Sun, 20 Aug 2023 15:50:22 +0000</pubDate>
      <link>https://dev.to/changoman/nextjs-app-router-dynamic-sitemap-seo-metadata-45pb</link>
      <guid>https://dev.to/changoman/nextjs-app-router-dynamic-sitemap-seo-metadata-45pb</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/581Rqs7W3xc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Let's add a dynamic sitemap.xml file to our Next.js blog, built using the new Next.js App Router. We'll also add some helpful metadata tags including the canonical url tag, the Open Graph protocol og tags, and twitter cards.&lt;/p&gt;

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;1:02 - A sitemap.xml file is essential to any website's SEO. It signals to search engines, like Google, that your site and pages exist.&lt;/p&gt;

&lt;p&gt;3:34 - You can create a sitemap.ts page under the /app directory to generate a sitemap with Next.js&lt;/p&gt;

&lt;p&gt;5:41 - To make a sitemap that is dynamic, you'll need to add or re-use code that loops through all of your blog posts or website pages, and get the url for each post or page.&lt;/p&gt;

&lt;p&gt;9:44 - Once your sitemap.xml is created, you'll want to submit this to Google Search Console so that it can start crawling and indexing your website's pages and blog posts.&lt;/p&gt;

&lt;p&gt;11:32 - We take a look at how metadata and meta tags work with the Next.js App Router. We also start to add other meta tags&lt;/p&gt;

&lt;p&gt;14:09 - The canonical url will help search engines know which url you want to be the "source of truth" for a particular page. This is the url that Google will want to index in the case of duplicate or near duplicate pages or links.&lt;/p&gt;

&lt;p&gt;15:36 - The Open Graph protocol tags will help show a nice picture and title when sharing your website with social media platforms such as Facebook and LinkedIn.&lt;/p&gt;

&lt;p&gt;17:56 - Twitter, or X, has specific meta tags it will look for when displaying your website on its platform. The twitter card metadata will make sure things look the way you want. You can preview these by going to any open graph preview site, such as &lt;a href="https://www.opengraph.xyz/"&gt;https://www.opengraph.xyz/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;19:37 - We add semi-dynamic metadata tags to our blog posts, and create a helpful function to generate the Next.js Metadata object.&lt;/p&gt;

&lt;p&gt;Here are some code gists for the code seen in the video:&lt;/p&gt;

&lt;p&gt;Sitemap.ts - &lt;a href="https://gist.github.com/ChangoMan/824daa0b4fbd6f824d2e8a2ab1532006"&gt;https://gist.github.com/ChangoMan/824daa0b4fbd6f824d2e8a2ab1532006&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Layout.tsx with Metadata - &lt;a href="https://gist.github.com/ChangoMan/a0754b24464cace64126d684bb45a812"&gt;https://gist.github.com/ChangoMan/a0754b24464cace64126d684bb45a812&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>seo</category>
    </item>
    <item>
      <title>A Web Developer in China, 2023</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Sun, 09 Jul 2023 14:11:11 +0000</pubDate>
      <link>https://dev.to/changoman/a-web-developer-in-china-2023-38ib</link>
      <guid>https://dev.to/changoman/a-web-developer-in-china-2023-38ib</guid>
      <description>&lt;p&gt;In June, 2023, my family and I uprooted our lives and moved to China. Although there were many motives for this move, the primary reason was to live with my wife's family and expose our daughter to the culture.&lt;/p&gt;

&lt;p&gt;My plan was to continue web development in China, but I had no idea if that was feasible. As many of us know, China strictly monitors the country's internet activity and blocks many crucial apps and services we rely on in this industry.&lt;/p&gt;

&lt;p&gt;Having lived here for almost a month, I can safely say that it is indeed possible to live as a digital nomad in China. There are, however, a few hurdles to overcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Great Firewall
&lt;/h2&gt;

&lt;p&gt;The biggest hurdle is that services such as Google, Gmail, and Twitter are blocked by China's firewall. Telegram, Zoom, and Discord are also blocked, so communication and access to news back home is not as accessible.&lt;/p&gt;

&lt;p&gt;Slack seems to be the only messaging app that is not blocked here, along with Microsoft Teams and Skype.&lt;/p&gt;

&lt;p&gt;I've had to set up a new Microsoft email address and forward all of my Gmail messages there.&lt;/p&gt;

&lt;p&gt;In the past, it was easy to get a VPN service, such as Express VPN, to solve this problem. However, Express VPN does not work for me anymore here in China. The only VPN service that works is one called Private VPN, but it is very slow.&lt;/p&gt;

&lt;p&gt;If anyone has a more reliable VPN service that they can recommend for China, please let me know!&lt;/p&gt;

&lt;h2&gt;
  
  
  Web Developer Tools in China
&lt;/h2&gt;

&lt;p&gt;To my surprise, Github and Gitlab actually work here in China. I have access to all of my code repos! Amazon AWS also works, which is great news if you rely of this for deployments.&lt;/p&gt;

&lt;p&gt;I mainly develop with Next.js and deploy to Vercel, both of which work behind China's firewall. Namecheap.com, my primary domain registrar, also works here.&lt;/p&gt;

&lt;p&gt;The main adjustment you'll need to make is switching from Goole to Bing as a search engine, which honestly isn't all that bad.&lt;/p&gt;

&lt;p&gt;I have successfully developed and deployed a complete website since my time here, without many issues. I just wish a better VPN services was available so that I can stay connected to Twitter and Telegram for longer periods of time.&lt;/p&gt;

&lt;p&gt;For more updates and details about life in China, check out my travel blog! &lt;a href="https://travelxfamily.com/posts/big-move-to-china"&gt;https://travelxfamily.com/posts/big-move-to-china&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>remotework</category>
    </item>
    <item>
      <title>Beautiful HTML Resume Templates with Tailwind CSS</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Wed, 11 Jan 2023 20:06:09 +0000</pubDate>
      <link>https://dev.to/changoman/beautiful-html-resume-templates-with-tailwind-css-55g4</link>
      <guid>https://dev.to/changoman/beautiful-html-resume-templates-with-tailwind-css-55g4</guid>
      <description>&lt;p&gt;Hello! I just released 5 HTML resume templates on my new site, &lt;a href="https://resumewind.com/"&gt;resumewind.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Resume Wind marketing site was built with Next.js and Tailwind CSS.&lt;/p&gt;

&lt;p&gt;The resume templates themselves are built with Tailwind CSS and are fully mobile responsive. Let me know what you think!&lt;/p&gt;

&lt;p&gt;If you want to try them out, leave a comment below and I can send you a discount code.&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>tailwindcss</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Next.js Ethereum Starter</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Sun, 09 Oct 2022 20:51:56 +0000</pubDate>
      <link>https://dev.to/changoman/nextjs-ethereum-starter-7fd</link>
      <guid>https://dev.to/changoman/nextjs-ethereum-starter-7fd</guid>
      <description>&lt;p&gt;Hey everyone! I've recently updated my repo for a Next.js Ethereum Starter. This starter template is meant to kickstart your Solidity and Blockchain development journey.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ChangoMan/nextjs-ethereum-starter"&gt;View the GitHub Source Code!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nextjs-ethereum-starter.vercel.app/"&gt;Live Demo Here!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/5fZFqB2LuTE"&gt;Quick Video Speedrun&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It uses &lt;a href="https://hardhat.org/"&gt;Hardhat&lt;/a&gt; as the Solidity and Ethereum development environment.&lt;/p&gt;

&lt;p&gt;On the Frontend, it's using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/"&gt;Next.js&lt;/a&gt; - React.js Framework&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://chakra-ui.com/"&gt;Chakra UI&lt;/a&gt; - React component library&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.rainbowkit.com/"&gt;RainbowKit&lt;/a&gt; - Web3 wallet connection made easy&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://wagmi.sh/"&gt;wagmi&lt;/a&gt; -  Suite of useful React hooks for Ethereum development.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know in the comments if you would like a more in-depth post or video on how to use this starter.&lt;/p&gt;

&lt;h2&gt;
  
  
  History and Motivation
&lt;/h2&gt;

&lt;p&gt;So a little history about what I've been up to and why I made this Next.js starter for Ethereum.&lt;/p&gt;

&lt;p&gt;I have a good friend and ex-coworker who fell down the Crypto and Ethereum rabbit hole back in 2018. Every once in a while, he would ask me to help him on the Frontend for his various projects.&lt;/p&gt;

&lt;p&gt;At the time, I wasn't into Blockchain development at all because most of the markets had just crashed. I was also focused on mastering React and the new frameworks such as Gatsby.js and Next.js. I would still help him out though, since it was some easy money on the side. I was also a little bit curious about how the blockchain worked in general.&lt;/p&gt;

&lt;p&gt;Fast forward to 2021, I took on a freelance project that involved NFTs called &lt;a href="https://songaday.world"&gt;https://songaday.world&lt;/a&gt;. I learned a lot about Crypto and NFT "culture" and became hooked (mainly due to the numbers going up). I eventually left my old job and got a Frontend role at a Crypto/NFT startup. The Crypto markets also came back to life during this time, so it was a pretty good opportunity to be more involved in the space.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Opportunity&lt;/strong&gt;, I want to stop and focus on this word for a bit. I know there's a lot of hate surrounding Crypto and NFTs, and a lot of it is 100% justified. We've all heard about the rampant scams, hacks, and drama. It all just looks like a huge ponzi scheme.&lt;/p&gt;

&lt;p&gt;However, it's hard to ignore the &lt;em&gt;potential&lt;/em&gt; opportunities. There are a lot of really smart developers trying to build stuff that is actually useful, and pretty much every major company has jumped into the scene. &lt;/p&gt;

&lt;p&gt;Now, I'm not trying to convince you that Web3 and Crypto is the "future", but I do think it's worth a small time investment. I've been in the space for about a year now and, from a Frontend developer's perspective, 95% of "Web3"  development is exactly the same. You're still mainly working with React, Javascript, and CSS. The extra 5% is learning about Crypto wallets, Ethers.js (which is basically lodash for Ethereum), blockchain events, and &lt;em&gt;maybe&lt;/em&gt; connecting with smart contracts.&lt;/p&gt;

&lt;p&gt;This extra 5% can open a lot of new doors, since the entire Crypto industry is hungry for developer talent. You'll be in much higher demand without a whole lot of time invested. This is my main thesis and reasoning behind driving Frontend devs into the Web3 space.&lt;/p&gt;

&lt;p&gt;My friend is still in the space and his main mission is to onboard new developers into Ethereum. He has a project called &lt;a href="https://github.com/scaffold-eth/scaffold-eth"&gt;Scaffold-ETH&lt;/a&gt; which is a quick start template for Ethereum development. This Next.js Ethereum Starter is my interpretation of his project.&lt;/p&gt;

&lt;p&gt;If you pull down the repo above, you can begin to see how everything is hooked up and how it's not that different than what you're already doing in React. When you connect a Crypto wallet, the wallet address is made available in a React Context. This makes it easy to pass around and perform functions on, just like any other React Context.&lt;/p&gt;

&lt;p&gt;There are a series of hooks you can use to read information from the blockchain and a smart contract, very similar to if you're just using a GET from a REST API. There are also hooks that help you write to a smart contract, which pops open your Crypto wallet for the interaction.&lt;/p&gt;

&lt;p&gt;I hope this repo and this post inspires you to at least give Blockchain development a curious peek. Check it out for yourself before falling into a dogmatic view of "Web3 is the FUTURE of everything" or "Web3 is EVIL".&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>ethereum</category>
      <category>solidity</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Next.js with Web3Modal Example</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Mon, 19 Jul 2021 22:19:58 +0000</pubDate>
      <link>https://dev.to/changoman/next-js-with-web3modal-example-mo1</link>
      <guid>https://dev.to/changoman/next-js-with-web3modal-example-mo1</guid>
      <description>&lt;p&gt;Hey everyone! I recently built an example website using Next.js and &lt;a href="https://github.com/Web3Modal/web3modal"&gt;Web3Modal&lt;/a&gt;. For those of you who don't know, Web3Modal is a simple way to connect your website to a Web3 / Ethereum wallet.&lt;/p&gt;

&lt;p&gt;This is essential when building a decentralized application (dApp) because you need a wallet to interact with the Ethereum application.&lt;/p&gt;

&lt;p&gt;Here is the example site: &lt;a href="http://web3modal-example.vercel.app"&gt;http://web3modal-example.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the source code: &lt;a href="https://github.com/ChangoMan/web3modal-example"&gt;https://github.com/ChangoMan/web3modal-example&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In order for the Web3Modal to work in your browser, you'll need the &lt;a href="https://metamask.io/"&gt;MetaMask&lt;/a&gt; Chrome extension, or a &lt;a href="https://registry.walletconnect.org/wallets"&gt;WalletConnect&lt;/a&gt; compatible wallet.&lt;/p&gt;

&lt;p&gt;I was going to create a full blog post explaining how everything worked, but wasn't sure if anyone would be interested.&lt;/p&gt;

&lt;p&gt;If you would like a more in depth explanation of the source code, let me know in the comments down below! Thanks for looking!&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>ethereum</category>
      <category>web3</category>
      <category>dapps</category>
    </item>
    <item>
      <title>Next.js Blog Starter with TypeScript and MDX</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Sat, 10 Apr 2021 15:02:54 +0000</pubDate>
      <link>https://dev.to/changoman/next-js-blog-starter-with-typescript-and-mdx-3kc6</link>
      <guid>https://dev.to/changoman/next-js-blog-starter-with-typescript-and-mdx-3kc6</guid>
      <description>&lt;p&gt;Hey Everyone!&lt;/p&gt;

&lt;p&gt;I just made a new website starter for Next.js, built with TypeScript, MDX, and Tailwind CSS. It should serve as a nice starting point for a personal blog or website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nextjs-typescript-mdx-blog.vercel.app/"&gt;Check out the demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get started:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/ChangoMan/nextjs-typescript-mdx-blog.git
&lt;span class="nb"&gt;cd &lt;/span&gt;nextjs-typescript-mdx-blog

yarn &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="c"&gt;# or&lt;/span&gt;
npm &lt;span class="nb"&gt;install

&lt;/span&gt;yarn dev
&lt;span class="c"&gt;# or&lt;/span&gt;
npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your development site will be up at &lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>typescript</category>
      <category>mdx</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>From HTML to React Part 1</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Mon, 08 Feb 2021 23:30:29 +0000</pubDate>
      <link>https://dev.to/changoman/from-html-to-react-part-1-1jjn</link>
      <guid>https://dev.to/changoman/from-html-to-react-part-1-1jjn</guid>
      <description>&lt;p&gt;&lt;em&gt;This article was originally published at &lt;a href="https://codebushi.com/html-to-react-1/"&gt;codebushi.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Several months ago, I started writing a "book" about making websites with Gatsby.js. It has become obvious to me that I will probably never finish this book, due to several personal reasons (loss of interest, having a toddler is hard, burnout from coding in general, I got a shiny PS5 during the holidays).&lt;/p&gt;

&lt;p&gt;Since there's already some content written, I figured it's better to share what I've got so far. Who knows, maybe I'll find the will to finish this some day. Maybe I'll use Next.js instead of Gatsby, since it seems to be a trend I'm more interested in. Anyhow, here is Part 1 of the book!&lt;/p&gt;




&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;Hello and welcome to &lt;em&gt;From HTML To React&lt;/em&gt;! In this book, you'll learn how to take an ordinary HTML and CSS website and transform it into a modern React,js site, using Gatsby.js. The goal of this book is to help you learn and practice modern web development skills with a JavaScript framework. By the end you'll have a published Gatsby site, written in React, that's blazing fast.&lt;/p&gt;

&lt;h3&gt;Why Gatsby?&lt;/h3&gt;

&lt;p&gt;Gatsby is a modern web framework based on React. The key word here is React, which has become the most popular JavaScript library around. Today there are tons of HTML/CSS/Bootstrap templates on the web, but they're still powered by jQuery. Now I won't say that jQuery is outdated, but I will say that it's not as desirable of a skill than React. Working with Gatsby is, in turn, working and practicing with React. This book will take the familiar concepts of a simple HTML website and translate them into React principals and best practices.&lt;/p&gt;

&lt;h3&gt;Who Is This Book For?&lt;/h3&gt;

&lt;p&gt;This book is not recommended for absolute beginners of web development or React. It's aimed towards the beginner/intermediate web developer who wants to take their skills to the next level. Someone who is comfortable working with HTML, CSS, and jQuery, but is trying to break into the world of React.&lt;/p&gt;

&lt;p&gt;This book also assumes you have a basic understanding of React. Subjects such as JSX, state, props, and components. If you are not familiar with the basics of React, I encourage you to go through the official &lt;a href="%5Bhttps://reactjs.org/docs/getting-started.html%5D(https://reactjs.org/docs/getting-started.html)"&gt;React documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The goal of this book is to reinforce and build upon the basics of React, by practicing with the familiar elements of a simple website.&lt;/p&gt;

&lt;h3&gt;The Steps Involved&lt;/h3&gt;

&lt;p&gt;First, we'll pick out a free HTML template to use with our project. We'll analyze the existing code and discuss which parts we'll be using for our new site. Spoiler alert, we won't be using any of the jQuery!&lt;/p&gt;

&lt;p&gt;We will then spin up a brand new Gatsby site and go over the basics of how it works. We'll import the existing CSS from our HTML template and organize the folder structure to begin building.&lt;/p&gt;

&lt;p&gt;In order to get in the habit of creating components, we take our existing HTML code and break it up, converting what we use into JSX and React components. The focus here is to get the new Gatsby site looking like the old site, without any of the old jQuery functionality.&lt;/p&gt;

&lt;p&gt;Finally we'll start to add back the functionality, but we'll be using React and React packages instead of jQuery plugins. Once we have everything working we will build and publish the site.&lt;/p&gt;

&lt;h3&gt;Tools You Will Need&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="%5Bhttps://nodejs.org/en/%5D(https://nodejs.org/en/)"&gt;Node.js and NPM&lt;/a&gt; installed on your machine&lt;/li&gt;
&lt;li&gt;The &lt;a href="%5Bhttps://www.gatsbyjs.org/docs/quick-start/#install-the-gatsby-cli%5D(https://www.gatsbyjs.org/docs/quick-start/#install-the-gatsby-cli)"&gt;Gatsby CLI&lt;/a&gt; installed on your machine&lt;/li&gt;
&lt;li&gt;A GitHub account for your code and publishing&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;Chapter 1: The HTML Template&lt;/h2&gt;

&lt;p&gt;There are many places to get HTML and CSS templates online. One of my favorite sites to get inspiration and design ideas is onepagelove.com, started by &lt;a class="mentioned-user" href="https://dev.to/robhope"&gt;@robhope&lt;/a&gt;
. They have a nice gallery of one page websites as well as design resources and web development articles.&lt;/p&gt;

&lt;p&gt;For our purposes, I'm going to pick a free to use HTML template so we all have a similar starting point. Head over to &lt;a href="https://www.free-css.com/free-css-templates/page257/evolo"&gt;https://www.free-css.com/free-css-templates/page257/evolo&lt;/a&gt; and download the free 'Evolo' template if you wish to follow along.&lt;/p&gt;

&lt;p&gt;You can also choose a different template or use one that you've made in the past, the principals are pretty universal.&lt;/p&gt;

&lt;h3&gt;Template Code Analysis&lt;/h3&gt;

&lt;p&gt;Open up the downloaded files and check out the &lt;code&gt;index.html&lt;/code&gt;. Since this is a one page website, all the HTML lives here. The file is broken up nicely for us into sections, such as &lt;code&gt;&amp;lt;!-- Navigation --&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;!-- Header --&amp;gt;&lt;/code&gt;. These are actually perfect chunks we can extract into their own React components later.&lt;/p&gt;

&lt;p&gt;At the very bottom of the file, we can see this is where all the JavaScript and jQuery is loaded.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Scripts --&amp;gt;
&amp;lt;script  src="js/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- jQuery for Bootstrap's JavaScript plugins --&amp;gt;
&amp;lt;script  src="js/popper.min.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Popper tooltip library for Bootstrap --&amp;gt;
&amp;lt;script  src="js/bootstrap.min.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Bootstrap framework --&amp;gt;
&amp;lt;script  src="js/jquery.easing.min.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- jQuery Easing for smooth scrolling between anchors --&amp;gt;
&amp;lt;script  src="js/swiper.min.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Swiper for image and text sliders --&amp;gt;
&amp;lt;script  src="js/jquery.magnific-popup.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Magnific Popup for lightboxes --&amp;gt;
&amp;lt;script  src="js/validator.min.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Validator.js - Bootstrap plugin that validates forms --&amp;gt;
&amp;lt;script  src="js/scripts.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- Custom scripts --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We won't be using any of these files, but we should make a note of what functionality they provide. React is popular enough to have its own version of most jQuery plugins, and we can recreate any leftover functionality.&lt;/p&gt;

&lt;p&gt;Open up the &lt;code&gt;/css&lt;/code&gt; folder and take a look at the CSS files. Again, we won't be using any of the CSS that's associated with the jQuery plugins. We also won't be using the &lt;code&gt;fontawesome-all.css&lt;/code&gt; since there are React specific Font Awesome packages available. The only files we'll need are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bootstrap.css
styles.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we've identified what parts of the template to use, the next step is to start our Gatsby site.&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>react</category>
      <category>gatsby</category>
    </item>
    <item>
      <title>Next.js Server Side Rendering and getInitialProps Intro</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Sun, 02 Feb 2020 22:38:00 +0000</pubDate>
      <link>https://dev.to/changoman/next-js-server-side-rendering-and-getinitialprops-intro-10n2</link>
      <guid>https://dev.to/changoman/next-js-server-side-rendering-and-getinitialprops-intro-10n2</guid>
      <description>&lt;p&gt;We take a look at the power of Next.js and how it handles fetching data using getInitialProps. We also cover some of the gotchas when working with server side rendering since the code runs on both the Node server as well as the Client/Browser.&lt;/p&gt;

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

&lt;p&gt;4:35 - Pages without the getInitialProps function will be considered by Next.js as a Static Page. If all of your pages are static, you can essentially use it as a static site generator.&lt;/p&gt;

&lt;p&gt;5:34 - Code in Next.js will be run both on the server side as well as the client/browser side. Trying to use something like window.location will fail on the server side because the window object only exists on the client side.&lt;/p&gt;

&lt;p&gt;8:33 - In order to fetch data using getInitialProps, we need to use the 'isomorphic-unfetch' package because that will work on both server and client.&lt;/p&gt;

&lt;p&gt;10:05 - When using getInitialProps, the object that is returned will end up as props in the React component. The props will also include the url object.&lt;/p&gt;

&lt;p&gt;11:33 - When visiting a page in Next.js directly, it will fire getInitialProps on the server and the data will be fetched on the server. If, however, you route to the page using the  component, the data will be fetched in the browser.&lt;/p&gt;

&lt;p&gt;13:14 - The fetched data from getInitialProps will show in when you view the web page's source code. This is the main reason to use the Server Side Rendering powers of Next.js&lt;/p&gt;

&lt;p&gt;16:00 - When building the site, Next.js will automatically determine if a page should be static or server side rendered. If you have any pages with SSR, then you'll need to deploy a Node server in order to host the site.&lt;/p&gt;

&lt;p&gt;19:54 - You don't have to use SSR. If you don't need the getInitialProps function and want data, you can use traditional data fetching methods like useEffect or fetch on componentDidMount.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>nextjs</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>JavaScript Local Storage Introduction</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Sat, 04 Jan 2020 19:58:03 +0000</pubDate>
      <link>https://dev.to/changoman/javascript-local-storage-introduction-57ge</link>
      <guid>https://dev.to/changoman/javascript-local-storage-introduction-57ge</guid>
      <description>&lt;p&gt;Introduction on how to use JavaScript's window.localStorage by creating a Dark Theme toggle for a simple site. We take a look at how to setItem and getItem from Local Storage.&lt;/p&gt;

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

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;6:42 - localStorage.setItem() takes two arguments, the first is the Key and the second is the Value. Both Key and Value must be a string. You can see these stored values in the browser's dev tools, under the Application tab.&lt;/p&gt;

&lt;p&gt;9:10 - To read from local storage, we use localStorage.getItem() and pass it the original Key that was stored. You will get back the string that was stored with the Key.&lt;/p&gt;

&lt;p&gt;11:18 - When reading from local storage, it's a good idea to check if something was returned first, and then proceed with your code.&lt;/p&gt;

&lt;p&gt;12:50 - If you're using local storage with React, you can store a React state object. You must first JSON.stringify() the object you want to store, since local storage only works with strings.&lt;/p&gt;

&lt;p&gt;14:35 - When reading from local storage, and getting a JSON string, you need to JSON.parse() the Value and turn it back into an object.&lt;/p&gt;

&lt;p&gt;15:50 - To use with React, one way is to setItem right after you perform a this.setState(), and you would stringify the object as you pass it into localStorage.setItem(). You can then getItem when you do a componentDidMount and this.setState() to retrieve your React state object from local storage.&lt;/p&gt;

&lt;p&gt;If you liked this video, please support it by &lt;a href="https://www.youtube.com/channel/UCS6lPt9btmTG3GkU82ELygA"&gt;subscribing to the channel!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also visit &lt;a href="https://codebushi.com"&gt;Code Bushi&lt;/a&gt; for more resources on Web Development!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Intro to the Fetch API &amp; Rendering Data with JavaScript</title>
      <dc:creator>Hunter Chang</dc:creator>
      <pubDate>Sat, 21 Dec 2019 17:06:25 +0000</pubDate>
      <link>https://dev.to/changoman/intro-to-the-fetch-api-rendering-data-with-vanilla-javascript-34ga</link>
      <guid>https://dev.to/changoman/intro-to-the-fetch-api-rendering-data-with-vanilla-javascript-34ga</guid>
      <description>&lt;p&gt;In this video, we take a look at the browser's built in Fetch API to get some dummy data. We then map over that dummy data to create some HTML with Vanilla JavaScript and render it onto the screen.&lt;/p&gt;

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

&lt;p&gt;Key Takeaways From The Video:&lt;/p&gt;

&lt;p&gt;3:20 - The Fetch API returns a Promise, so you need to wait for the promise to resolve by using .then() after it.&lt;/p&gt;

&lt;p&gt;4:16 - After the promise is resolved, you will get a Response object, which will tell you the status code of the response among other details&lt;/p&gt;

&lt;p&gt;5:15 - We need to run the .json() method on the response object to turn the response into more useful data. The .json() method will also return a promise, so we need to chain another .then() onto it.&lt;/p&gt;

&lt;p&gt;8:10 - When using the Fetch API, it won't automatically throw all errors. You have to manually check to see if the response object has an "ok" property on it, and throw an error if it's not. This will help you catch things like a 404 error with the response.&lt;/p&gt;

&lt;p&gt;11:11 - In order to render our data to the screen, we can use innerHTML or insertAdjacentHTML and insert an HTML string into an existing HTML element.&lt;/p&gt;

&lt;p&gt;14:13 - Since the data we get back is an array, we can perform .map() on the array to loop over the data. We then use Template literals to construct our HTML string.&lt;/p&gt;

&lt;p&gt;22:10 - With the Fetch API, you can also perform a POST request by adding additional options when making the request. Make sure to add the proper "headers" and use JSON.stringify() in the body of the request.&lt;/p&gt;

&lt;p&gt;If you liked this video, please support it by &lt;a href="https://www.youtube.com/channel/UCS6lPt9btmTG3GkU82ELygA"&gt;subscribing to the channel!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also visit &lt;a href="https://codebushi.com"&gt;Code Bushi&lt;/a&gt; for more resources on Web Development!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
