JCJason Cheninjason60810.hashnode.dev·Aug 20, 2023 · 1 min readCommon Mistakes in Conditional Renderinghttps://youtu.be/Rr5AqASIyxw TL;DR When using 0 in JSX, although it's falsy, it still gets rendered. Official documentation specifically warns to be careful Logical AND operator (&&) Be especially mindful of the usage of the number 0 when using...00
JCJason Cheninjason60810.hashnode.dev·Aug 13, 2023 · 2 min readAlways Use a Custom Hook for Context API, Not useContext (React Context API, TypeScript)https://youtu.be/I7dwJxGuGYQ Step 1: Create the Theme Context First, we need to create the context for our theme. import React, { createContext, useState } from 'react'; type Theme = 'dark' | 'light'; type ThemeContextProps = { theme: Theme; s...00
JCJason Cheninjason60810.hashnode.dev·Apr 9, 2023 · 5 min readLeetCode - 21. Merge Two Sorted ListsSolution with comments //=========== visualization ==================== Initial state: l1: { val: 1, next: { val: 2, next: { val: 4, next: null } } } l2: { val: 1, next: { val: 3, next: { val: 4, next: null } } } //=========== visualization...00
JCJason Cheninjason60810.hashnode.dev·Mar 26, 2023 · 2 min readUsing REST APIs with Protobuf in a Next.js and TypeScript App (Backend in Go)Compiling .proto Files into TypeScript Using ts-proto In my experience working with an Nx monorepo Next.js project on Windows, I encountered a path issue that prevented me from compiling the .proto file directly. To resolve this problem, I had to cre...00
JCJason Cheninjason60810.hashnode.dev·Mar 12, 2023 · 2 min readNext.js Tutorial For Beginnershttps://youtu.be/qwhMyVVnmKM nextjs-youtube-demo Link Global Layout and CSS Nav dynamic className base on the route getStaticProps export async function getStaticProps() { const response = await fetch("https://learnwebcode.github.io/json-examp...00