All Posts

Here is a list of all of my posts, sorted by the date they were published. Use the input below to filter posts by title, subtitle, description, or tags.

Displaying 131 posts
The Consciousness Lottery
For years now, I've been using the phrase “the consciousness lottery” in conversation and I wanted to put it into writing finally. Come learn what it is and why you should add it to your vernacular.
Thoughts
Philosophy
How I Built “Test Your Focus”
In my previous post, I used a "Test Your Focus" mini-game as a metaphor for describing my ADHD. Let's learn how to build it using React.
React
JavaScript
TypeScript
What ADHD Feels Like to Me
While we have made great progress in understanding ADHD, it can still be difficult for some to grasp the impact it has on those who struggle with it. Let me show you what having ADHD sometimes feels like to me with a simple interactive game.
Thoughts
Productivity
Prefer Explicit Maps
Sometimes we write unnecessary complexity without realizing it. Let's see how we often do this with ternaries and learn how using a map will remove complexity and improve maintainability.
TypeScript
JavaScript
My git Workflow for Refactoring
Refactoring is a key part of my development process. Let me show you the git workflow I use to make refactoring just another step in building features or other code changes.
Git
Software Engineering
Productivity
Never Call new Date() Inside Your Components
Calling impure functions with side effects like new Date() or Math.random() is a disaster waiting to happen. Learn what to do instead.
React
JavaScript
TypeScript
Functional Programming
Composable Flourishes
Learn how we can use composition to create subtle, pleasant animations that can be used on any component in our applications.
Astro
JavaScript
CSS
Prefer Alphabetized Object Keys
Small efforts can add up to big gains, given enough time. That's how I feel about alphabetizing my object keys. By always sorting them, I increase the speed at which I can read, and even write, code.
JavaScript
TypeScript
React
Responsive Design and Composition
Responsive UI can be very challenging to write well and can often lead to some of the nastiest code you have ever encountered. Learn how to use multiple compositions to make responsive design a whole lot cleaner and easier.
React
CSS
Tailwind
Refactoring
Design System Retrospective
What I learned and what I would do differently
I built a cross platform (React & React Native) design system at my last company. I'm in the middle of building another one for a client. Let me tell you what I learned, decisions I regret, and what I'm doing differently this time.
React
Design Systems
CSS
Tailwind
Prefer Noun-Adjective Naming
English grammar puts the adjective before the noun, but when it comes to file or function naming, I think you should do the opposite.
React
JavaScript
TypeScript
Prefer Multiple Compositions
aka Prefer Understandability and Maintainability Over Absolute DRYness
The flexibility of JavaScript and React means there are lots of ways to achieve the same result. Let's consider why we might choose one way over another when it comes to React. Specifically, when to choose a more verbose solution with composition over the DRYest code possible.
React
JavaScript
TypeScript
Refactoring
align-items: center vs. text-align: center
aka Understanding flex columns better
Learn when to use align-items: center or text-align: center in Flex columns.
React
CSS
Tailwind
Creating a React Native “Curved Bottom Bar” with Handwritten SVG
I recently made a "curved bottom bar" in React Native for a client. Instead of using a library, let's build it from scratch with some handwritten SVG. It's no where near as intimidating as it sounds.
React
React Native
SVG
JavaScript
Tailwind “Minimum Full Height” Layout
I've been using Tailwind CSS on a lot of projects lately. Almost all my layouts for these projects are some version of the "minimum full height" layout, and I wanted to quickly show you how I do that with Tailwind.
Tailwind
CSS
Make Checkpoint
aka How a Makefile Improves my Side Projects
Learn how to create a simple Makefile to quickly create a "checkpoint" in your Git history when you are rapidly prototyping.
Productivity
Prototyping
Scripts
Agathist VSCode Themes
I created a VSCode theme inspired by Agathist's brand colors and released it as a VSCode Extension.
VSCode
Two Types of Composition
Not only is "composition" a confusing word, but there is more than one way to do it. Let's break those ways down into two types and learn about "nesting composition" versus "merging composition".
JavaScript
TypeScript
Software Engineering
Agathist Q&A
Agathist is my new software development firm. Learn about it in this self-directed question and answer post.
Career
No Outer margin
It is an anti-pattern to add margin to the outermost element of a component. It breaks encapsulation and makes components difficult to reuse. Let's learn what to do instead.
React
CSS
Reusability
Anti-patterns
Type TODO
In TypeScript, sometimes any is our best option, but we can go a step further and give ourselves a little more signal than that.
TypeScript
Wrangling Tuple Types
TypeScript doesn't know whether you're returning an array or a tuple from a function, so let's learn a couple ways we can fix that problem.
React
TypeScript
UI Composition
AKA taking a step back to take a step forward
Often we run into tricky UI situations as a result of overloading an element with styling responsibilities. We can solve this problem by separating the responsibilities and re-composing the individual components.
React
Typescript Prevents Bad Things... and Good Things
TypeScript is great at preventing bad things from happening, but it can prevent us from having some good things, too. When writing the types for functionality is onerously more difficult than writing the functionality itself, we might miss out on the good things that could have been.
React
JavaScript
TypeScript
Quit Your YAP-ing
Learn when adding yet another prop to a React component becomes a problem and how to fix it with composition.
React
Compound Components
Keep it flexible, keep it working
Ever been given a requirement to keep all the existing functionality of a component working, but allow for arbitrarily different layouts? Here's how to handle that.
React
Context, Composition, and Flexibility
Using React Context and component composition, we can achieve both flexibility and different functionality
React
Algorithms: Insertion Sort
Learn the insertion sort algorithm in JavaScript and why it is slightly better than bubble sort
Data Structures and Algorithms
Algorithms: Bubble Sort
Learn the bubble sort algorithm in JavaScript, and why it is such a bad way to sort items
Data Structures and Algorithms
JSX was a Mistake
JSX makes writing UIs feel really familiar for frontend devs, but it can obfuscate a key detail of which we should remain aware.
React
Capture Phase Event Handling in React
Did you know you can declaratively handle events in the capture phase in React? I sure didn't until recently. Let's learn how.
React
Why Use useReducer?
Do you know why you might use `useReducer` instead of `useState`? There are a few key questions you can ask yourself to make that decision.
React
Patterns for Functions with Conditionals
Let's explore two common function patterns for managing the complexity of conditional code.
JavaScript
Software Engineering
Refactoring
Updating State with a Component
Not with a State Updater Function
Have you ever wanted to create a component like `Head` from `next/head` or `Helmet` from `react-helmet` that would update some state by using the `children` of a component? It's simpler than you might think.
React
JavaScript
Conway's Game of Life
Learn how to build Conway's Game of Life with JavaScript, React and the simulation pattern.
JavaScript
React
The Simulation Pattern
The “simulation pattern” is a useful tool for anyone's programming repertoire. Let's learn how to use it on almost any state problem that advances by discrete increments.
JavaScript
Computer Science
The Wrapped State Setter Pattern
Sometimes we want to add functionality that happens with every call of a state setter. Learn how to wrap that state setter to add it.
JavaScript
React
Parametric Design
Parametric design is the process of using adjustable parameters to modify and influence a design. Add it to your box of tools.
JavaScript
React
The “Folded Code” Test
Many text editors allow you to fold, or collapse, blocks of code. I believe we can improve the design of our code by using this to our advantage.
JavaScript
Software Engineering
My Course Platform
How and Why I Built It
I am about to launch a course platform of my own making at https://courses.kyleshevlin.com. It is not fancy. But it is my own.
Career
Thoughts
How I Would Use a UI Library
UI Libraries are great for having a solid design system to build from. Here's a small architectural decision I would do to make them even nicer to work with.
React
JavaScript
What is a Factory Function?
Factory functions help us quickly create objects. They make use of closures to have private values and functions, all while avoiding the `this` keyword. Learn how to use them in this article.
JavaScript
Computer Science
Careful with Context Composition
Be careful with how you compose your UI when using Context. You might be making a common mistake causing extra rerenders.
React
Comparing `useRef` and `useState`
People are often confused by `useRef`. Let's try and fix that confusion by comparing it with `useState`.
React
JavaScript
What is a Closure?
JavaScript closures are confusing for some, but they do not have to be. Learn what a closure is and why they are a powerful tool to have in your programming repertoire.
JavaScript
Computer Science
Prefer Function Updaters in State Setters
React state can be updated in two ways: replace the `currentState` with the `nextState`, or transform the `currentState` to the `nextState` with a function. Prefer the function.
React
JavaScript
Dependency Injection and Default Parameters
or One Way to Make Your Programs More Flexible
Learn how to increase the flexibility and testability of your programs by passing dependencies in as function arguments alongside default parameters.
JavaScript
Discriminated Unions and Destructuring in TypeScript
Discriminated unions in TypeScript can go awry when you use object or array destructuring. Learn why it happens and what you can do to fix the problem.
React
JavaScript
TypeScript
Prefer Declarative State Updaters
or Don't Pass Around Naked State Setters, Please
Learn how declarative state updaters improve the quality of your component's code.
React
How I Structure My React Projects
React and modern JavaScript gives you the freedom to structure your React projects however you want. Learn how I structure mine.
React
What are “Magic Values”?
Learn what "magic values" are in programming and how to avoid them to improve the quality of your code.
JavaScript
Software Engineering
`useMemo` and Stable Values
A short explanation on how I use `React.useMemo` to stabilize values for re-renders.
React
Symbolic Logic
or Algebra meets Logic
Symbolic logic, the study of reducing arguments to an algebraic notation, can be useful knowledge for debugging and reasoning about programs.
Software Engineering
Set Theory
A Primer
Learn the fundamentals of Sets and how understanding them may benefit you as a software engineer and programmer.
JavaScript
Computer Science
What is a Tuple?
Learn the concept of a tuple, an ordered, finite list of items that represents an implicit key/value store, and where you might already be using them in JavaScript.
JavaScript
React
React Hooks
Conditional React Hooks
Learn how to conditionally use React Hooks by conditionally rendering a "renderless component".
React
React Hooks
Debounce and Throttle Callbacks with React Hooks
Learn how to debounce or throttle a callback function with React hooks while avoiding an exhaustive deps ESLint error
React
React Hooks
How to Use React Context Effectively
Learn how to use React Context effectively in your web applications by using custom hooks and memoization.
React
React Hooks
JavaScript
Facade Pattern
or why this pattern might save your bacon
Learn how the "facade pattern" can be used in JavaScript to make it easier to swap libraries, increase code flexibility, and hide complexity in your applications.
JavaScript
React
Computer Science
Software Engineering
useEncapsulation
or Why Your React Components Should Only Use Custom Hooks
Improve the quality of your codebase with encapsulation and custom React hooks.
JavaScript
React
React Hooks
Computer Science
Encapsulation
or the Primary Purpose of Functions
Typically, functions are written for their reusability, but I want to convince you that the reason to reach for a function is to encapsulate a concern.
JavaScript
React
Computer Science
Refactoring
Use Old School State
or Bringing Back the Callback
Let's kick it old school and create a custom React hook that takes a callback second argument for `setState`.
React
JavaScript
Helpful Debugging Hooks
Learn some helpful debugging hooks for improving React component performance.
React
React Hooks
JavaScript
Headlight Vision
or The Challenge of Only Driving at Night
Do you ever feel like you're always stuck in someone else's rearview, failing to ever catch up to them? Might be time to change your persective.
Thoughts
Pattern Matching in JavaScript
...well, sort of...
In this post, Kyle Shevlin demonstrates using a switch statement to replicate a form of pattern matching in JavaScript.
JavaScript
Generator Functions
In this interactive article, Kyle Shevlin explains a seldom used feature of JavaScript: generator functions. Learn the basics of how they work and how they might be useful.
JavaScript
Multiple Boolean Props are a Code Smell
Having a component that receives multiple props that are booleans can be a sign of a code smell. It's likely your component now contains impossible states that should be avoided. Moving those props to a single prop that receives an enumerated set of strings is a better approach.
JavaScript
React
Mental Model of Use Effect
or Don't Use the Dependencies Array as a Conditional
The React.useEffect hook can be challenging to get right. One way to easily mess it up is to incorrectly use the dependency array. This post demonstrates how to think about it correctly.
JavaScript
React
React Hooks
Tic-Tac-Toe in React
In this blog post, Kyle Shevlin teaches you how to build tic-tac-toe in React using CSS grid and the `useReducer` hook.
React
JavaScript
Using `React.memo` to Avoid Unnecessary Rerenders
We can use the top level `React.memo` API to avoid unnecessary rerenders of our function components in a React app. In this post, Kyle Shevlin will teach you how it works.
React
JavaScript
Memoization: What, Why, and How
Trading Space for Time
Recently, I spent an hour with one of my protégés demonstrating some common advanced techniques we use at Webflow. One of the techniques I showed them was memoization. Let's learn what memoization is, why you might use it, and how do we write it from scratch.
JavaScript
React
Computer Science
The Three Kinds of React State
Learn the three ways to manage state in React applications from Kyle Shevlin
React
Adding Guards to a `useReducer` Finite State Machine
React
React Hooks
State Machines
Break Out Your Component Logic with Hooks
In this post, Kyle Shevlin demonstrates how to decouple the logic of a React component from its user interface through the use of a custom hook. This enables the encapsulation and reuse of a concern, contextualized for the particular use case.
React
React Hooks
Refactoring
Adding Infinite States to a `useReducer` Finite State Machine
In this post, Kyle Shevlin explains how to store and update infinite state data in a finite state machine built upon the useReducer React Hook.
React
React Hooks
State Machines
Can a State Machine be a String?
A Superfluous Experiment in Brevity
In this blog post, Kyle Shevlin walks through an experiment in writing a state machine as a string of text following test driven development.
React
State Machines
How to Use `useReducer` as a Finite State Machine
In this post, Kyle Shevlin demonstrates a way to make React's `useReducer` hook behave like a finite state machine.
React
React Hooks
State Machines
Guidelines for State Machines and XState
Here are some guidelines for creating and using state machines with the XState library with React.
React
State Machines
Managing Cyclomatic Complexity
Understanding cyclomatic complexity and how to manage it can level you up as a programmer
Data Structures and Algorithms
Computer Science
Recursive React Components
React components are _just_ functions. We can use the same patterns on components that we do on other functions, including recursion. Let's make some recursive components.
React
Computer Science
Data Structures and Algorithms
Enumerate, Don't Booleanate
We learn how to use booleans early and often, but they are not the right tool for the job sometimes. A enum may solve our problems with greater precision.
React
State Machines
The Future of Second Career Devs
I started the Second Career Devs podcast in 2017 with a lot of excitement and hope. Let me tell you where my head is at now on the project
0
How to Render an Object in React
Building a `Log` Component
Learn how to render an object in React by using JSON.stringify
React
How to Add Algolia Search to a Gatsby Site
Learn how I added Algolia Search to my Gatsby site or blog. It was pretty easy and a lot of fun.
Gatsby
React
Graphs Are Everywhere
A graph data structure is a useful way to model many things in the real world. Take a look at data visualizations that show this.
Computer Science
Data Structures and Algorithms
When `else`s Make Your Code Worse
or An Example on How Small Refactors Can Improve Your Code
In this article, Kyle Shevlin teaches us how we can simplify the conditional logic of our code by refactoring it without `else` blocks.
Refactoring
Software Engineering
A Plea for Imagination
aka Learn to Remix
You have an imagination. I am asking that you use it.
Thoughts
Just Enough FP: Composition
Functional composition is the act of taking the output of one function and passing it directly as the input to the next function.
Functional Programming
JavaScript
Just Enough FP: Pointfree
Pointfree programming is a style of programming that favors passing the function itself as an argument rather than using lambda functions to operate on data. It focuses on the composition of functions rather than micro-managing your data.
Functional Programming
JavaScript
Just Enough FP: Argument Order
Learn about how argument order impacts the composability of higher order functions.
Functional Programming
JavaScript
Just Enough FP: Partial Application
Learn what "partial application" is and why it matters in functional programming.
Functional Programming
JavaScript
Just Enough FP: Currying
Learn what currying is, how to make curried functions, and what the pattern is useful for.
Functional Programming
JavaScript
Just Enough FP: Immutability
Learn what "immutability" is and why it matters in functional programming
Functional Programming
JavaScript
Just Enough FP: Pure Functions
Learn what a "pure function" is, why they are important for functional programming, and how they can improve the quality of your code.
Functional Programming
JavaScript
Just Enough FP: Higher Order Functions
Learn what a "higher order" function is and why they are important.
Functional Programming
JavaScript
Just Enough Functional Programming Course Launch
I released a course on Egghead about functional programming. Check it out.
Functional Programming
JavaScript
Your Own Gathering
People express FOMO regarding our regular gatherings for drinks and conversation here in Portland. I think you can start your own gathering and here's why.
Thoughts
Firebase and Gatsby, Together At Last
or How I Fixed an Unexpected Snafu
Kyle Shevlin breaks down the steps it took to get Firebase, Gatsby, and Netlify to work for the new "beard stroke" post-liking feature of his blog
Firebase
Gatsby
React
State Machines: The XState Visualizer
Sometimes seeing is understanding. XState provides a visualizer tool that allows us to see our state machine as a graphical interface, and not just code.
State Machines
State Machines: Our First XState Machine
How do we create a state machine using the XState library. In this article, we will create our first state machine using XState.
State Machines
State Machines: What Are They?
What is a state machine? A state machine is a way to represent all the enumerated possible states and events of a given system. In this article, we will create a rudimentary state machine and interpreter in JavaScript.
State Machines
Why I Rewrote My Blog With Gatsby
Or How to Respond When Your WordPress Blog Gets Hacked
Learn why I recently had to abandon my WordPress setup and opted for Gatsby instead.
Gatsby
React
The Importance of Competing Thoughts
Sometimes it's important to hold two or more competing thoughts at the same time.
Thoughts
The Role of Timing In a Job Hunt
A discussion on the role of timing in your job hunt.
Career
How to be More Successful on Your Next Web Developer Job Hunt
Here are some of the best tips I have on making your next web developer job hunt more successful.
Career
3 Tips for Changing Your Career to Coding
and One Bonus Tip! (Why Keep You in Suspense, Right?!)
In this post, Kyle Shevlin shares several tips on how to make a career change into web development and software engineering
Career
Let Me Tell You About This Cat
Allow me to share a deeply touching moment I shared with a local cat recently, and how I will never forget the encounter.
Thoughts
From Pastor to Programmer
or Telling My Story Once and For All
In this article, Kyle Shevlin explains how he made the career change from being a pastor to a programmer.
Thoughts
Not All “Just JavaScript” is the Same
A not-so-small rant about why two JavaScript frameworks can feel so vastly different.
Thoughts
How to Write Your Own JavaScript DOM Element Factory
A Basic HyperScript h() Function
Learn how to write a JavaScript DOM element factory function from scratch.
JavaScript
My Mock Interview Experience with Rick Altherr from Google
or Practice Without the Pressure
A recap of my mock interview experience with a Googler.
Career
Make Your Own Charts in React Without a Charting Library
Learn how to make your own data chart with React and SVG without using a data visualization library.
React
Data Visualization
SVG
How I Stumbled Upon Normalizing Redux State
and later learned it's a real thing
Learn how I stumbled my way into discovering normalizing Redux state.
JavaScript
Redux
ShevyJS
Announcing a new library, ShevyJS, a vertical-rhythm library for CSS-in-JS.
JavaScript
What I Love About React #1
Renders with Ternaries
Learn how to use ternaries for conditional rendering in React.
React
What is Most Important to a Web Developer?
the Tech, the Product, or the People
I recently asked developers what was most important to them. The results were a bit surprising.
Career
Renderless Components
or How Logic Doesn't Always Need a UI
Renderless components are a way to use React's component model for side effects and logic that isn't mapped directly to your UI
React
Redux
Zeno's Paradox of Infinite Loop Scrolling
or Everything Moves but You
I recently learned a lesson eerily similar to a Greek paradox.
JavaScript
Head Scratcher #1
Making a 2D Array by Sorting an Array of Objects
Read along as I solve a tricky problem with Array.reduce()
React
How to Dynamically Render React Components
Learn how to dynamically render React components based on a discriminated object property.
React
Loading State Trick for Stateless Functional Components in React
Learn how to show a loading indicator for function components in React.
React
How To Use Client Side Libraries in a Universal JavaScript App
Learn how to use client-only libraries in server-side rendered React apps.
React
State Snapshots in Redux
Learn how we can store a previous state as a "snapshot" in Redux.
Redux
Why I Think Opening External Links In New Tabs Is a Bad Idea
A short rant on why forcing users to open links in new tabs is silly.
Thoughts
JavaScript: External Links in New Tabs
Learn a quick JavaScript tip for opening external links in new tabs.
JavaScript
Intro to D3.js and Data Visualization
Learn how to use `d3`, the popular data visualization library.
D3
Data Visualization
Using && and || in Bash Scripts
Learn how to use logical AND and OR in bash.
Bash
My Favorite Git Aliases
Learn some of my favorite git aliases.
Bash
Bash Shortcut: Copy your Present Working Directory to your Clipboard
Create a bash alias that copies your `pwd` to your clipboard.
Bash
Bash Shortcut: How to Make Directory and Change Directory in One Command
Make a bash alias to make a new directory and change to it in one command.
Bash
Small Gripe: Target=“_blank”
A tiny rant about `target="_blank"`.
Thoughts
Logo for Array.reduce()
Array.reduce()
Check out my courses!
If you enjoy my posts, you might enjoy my courses, too. Click the button to view the course or go to Courses for more information.
Sign up for my newsletter
Let's chat some more about TypeScript, React, and frontend web development. Unsubscribe at any time.