#react useCallback returns the same function reference if it gets the same dependencies
// different function on every render
let fn = name => dispatch({type: ADD, name})
// same function on every render
let fn = useCallback(
name => dispatch({type: ADD, name}),
[dispatch]
)
useMemo: will call the function is the dependencies has changed
useCallback: will give you a new function that you can call, so it gives you a function rather than the result
#javascript#react#reacthooks#useMemo#useCallback
so, i'm releasing 2 rather specific libs today. one is cannon-es, a esm port of cannon by @schteppe: github.com/drcmda/cannon-es (looked unmaintained, didn't bother making a PR) and the other is use-cannon, a super rough web worker bridge for physics in react: github.com/drcmda/use-cannon
Clean Code concepts for JavaScript: bit.ly/clean-code-js ~ a huge collection of patterns for writing readable, reusable, and refactorable code. By @ryconoclast
🔥 Perfectly aligning checkboxes with text is super annoying, especially when the text wraps on to multiple lines.
Here's an approach I use to always perfectly center them with the first line of text, no matter the text length or size 👉
codepen.io/adamwathan/pen/bG…
Dear @YouTube now you become a “box” full of adds, even @xvideoscom and @pornhub don’t abuse the user with that, you are INFINITELY rich...what that fuck?
Я просто хочу поблагодарить @eggheadio за то, что вы заставляли мою карьеру идёт дальше, чем я ожидал. Пусть так)))
I just want to thank @eggheadio for making my career going further than I expected. Keep it that way)))
#react#javascript
山 - shān = mountain
出 - chū = get out (it represents two mountains stacked on top of each other, in ancient China, emperors exiled their enemies beyond the mountains, so nowadays exile has become to mean of “get out”)
#fuckingawesome#охуйтельно
Russian is hard, specially on @code
“Переключить вертикальное или горизонтальное расположение окон редактора”
Same as:
“flip layout”
#vscode#javacript#какогохуя