#javascript
Articles
NPM: What are project dependencies?
The difference between dependencies, devDependencies, and peerDependencies in a package.json, and when to use each type in a Node.js project.
Making React Fast: Tips on Optimizing ReactJS
React performance from the ground up. How the reconciler works, when re-renders hurt, and the tools (memo, key, useMemo) for fixing jank.
Intro to Functional Programming
Functional programming built around immutable data, pure functions, and first-class functions. Adapted from a Boise Code Camp talk.
Introducing React-Scroll-To v2
Release notes and usage guide for react-scroll-to v2, a React component for scrolling to a point, a ref, or smoothly animating between them.
React: Controlling Rendering with Keys
The React key prop does more than silence warnings. Use it to force components to re-mount on demand, with a concrete example of why that helps.
Tips on Improving FabricJS Speed
Techniques that sped up FabricJS rendering of ~10k objects on a Canvas: disabling renderOnAddRemove, using enlivenObjects, and batching object loading.
React: Not Everything is State
Not every value in a React component belongs in state. Using class properties for IDs, timers, and non-rendering data keeps components simpler and faster.
Part Two: Using Typescript with Redux
Part two of using TypeScript with React: adding Redux. How to type actions, reducers, and connected components without fighting the compiler.
Generic Type Arguments in JSX Elements
How to use TypeScript 2.9's generic type arguments in JSX to build React components that extend their props while staying fully type-safe.
Part One: Using Typescript with React
Part one of a series on TypeScript with React. Build a typed counter, and cover props, state, and the setup pitfalls that trip people up.
Reusable Components: Factory Components
How to use the Factory Component pattern in React to split bloated 'mega components' with dozens of props into small, focused pieces.
Global Component Registration
Registering React components in a global store so modals and similar widgets can be triggered from anywhere in the app. Borrowed from Insomnia's source.
Encapsulating State with Functional Children
How to use functional children (what the community now calls render props) in React to share reusable stateful logic between components.
Tips on Creating Reusable Components
Tips for building reusable React components: keep them small, keep them composable, treat UI as a function of state.
Introduction to Higher Order Components
Higher Order Components (HOCs) in React, explained: what they are, why they work, and how to write one from scratch.
Injecting Dynamic Elements to Components
Letting consumers of a reusable React component swap the underlying HTML tag or child component, so you stop shipping ten near-duplicate versions.
Intro to FlightJS
Building a counter component with FlightJS, Twitter's component-based JavaScript framework, from scratch.