This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ruby Quickstart for Refugees: | |
-- | |
# is a comment. | |
You don't need semicolons. | |
Ruby aims to be elegant and readable, so punctuation and boilerplate are | |
minimal. | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IValue<T> { | |
type: 'value' | |
value: T | |
} | |
interface IError<E extends Error> { | |
type: 'error' | |
error: E | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUwuString(a){return a.replace(/[.]/g,"!!!").replace(/th|Th/g,"f").replace(/W/g,"w-w").replace(/l|L|r|R/g,"w").toLowerCase()}function uwuify(a){var b=["^~^","UwU","OwO","O_O","O_o","oWo","OvO","UvU","*~*",":3","=3","<(^V^<)"];if(null==a)var a=document.body;a.childNodes.forEach(function(a){if(!(3===a.nodeType))uwuify(a);else if(""!==a.nodeValue.trim()){var c=a.nodeValue;c=getUwuString(c),0==Math.floor(2*Math.random())&&(c+=" "+b[Math.floor(Math.random()*b.length)]),a.nodeValue=c}})}uwuify(); |
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