⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,
I've recently ran into a pitfall of [React.memo()
][memo] that seems generally overlooked; skimming over the top results in Google just finds it mentioned in passing in a [React issue][regit], but not in the [FAQ] or API [overview][react-api], and not in the articles that set out to explain React.memo()
(at least the ones I looked at). The issue is specifically that nesting children defeats memoization, unless the children are just plain text. To give a simplified code example:
const Memoized = React.memo(({ children }) => (<div>{children}</div>));
// Won't ever re-render
<Memoized>bar</Memoized>
// Will re-render every time; the memoization does nothing
#!/usr/bin/perl | |
# Scan unstaged changes in git tracked files, identify which commits they could | |
# be applied to as fixups, and automatically produce the appropriate "fixup!" | |
# commits for use with "git rebase -i --autosquash". | |
# | |
# Copyright (C) 2016, 2017 by Mat Sutcliffe | |
# This program is free software; you can redistribute it and/or modify it under | |
# the GNU General Public License as published by the Free Software Foundation; | |
# either version 2 of the License, or (at your option) any later version. |
#include <Windows.h> | |
#include "../../API/RainmeterAPI.h" | |
struct ACCENTPOLICY { | |
int nAccentState; | |
int nFlags; | |
int nColor; | |
int nAnimationId; | |
}; | |
struct WINCOMPATTRDATA { |
/** | |
* @document Permutations.ts | |
* | |
* I wanted to figure out, just for the challenge of it, whether I could, given an array type `A`, produce a type that | |
* matches any array with every element of `A` exactly once in any order. I *love* abusing the TS typing engine. It | |
* insulted my mother once. | |
*/ | |
/** | |
* Returns an array type that includes every element of `T` exactly once in any order. |
Lightning talk proposal for the Reactive 2016 Conference. Here's a handy retweet link
When I started writing React apps, I approached components as if they were “just the V in MVC!” Seriously, we’ve all heard it.
I have found this to be an inferior way of thinking about and building React applications. It makes people treat React as a drop-in replacement for something like a Backbone or Angular 1.x View. In other words, people treat it like a glorified template system with partials and don’t harness the power of its functional paradigms.