| name | no-use-effect |
|---|---|
| description | Enforce the no-useEffect rule when writing or reviewing React code. ACTIVATE when writing React components, refactoring existing useEffect calls, reviewing PRs with useEffect, or when an agent adds useEffect "just in case." Provides the five replacement patterns and the useMountEffect escape hatch. |
This file contains hidden or 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
| "use client"; | |
| import { animate } from "motion"; | |
| import { | |
| motion, | |
| MotionValue, | |
| useMotionTemplate, | |
| useMotionValue, | |
| useTransform, | |
| } from "motion/react"; |
This file contains hidden or 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
| [ | |
| { | |
| "key": "h", | |
| "command": "editor.action.scrollLeftHover", | |
| "when": "editorHoverFocused" | |
| }, | |
| { | |
| "key": "j", | |
| "command": "editor.action.scrollDownHover", | |
| "when": "editorHoverFocused" |
This file contains hidden or 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
| { | |
| "vim.smartRelativeLine": true, | |
| "editor.cursorSurroundingLines": 8, | |
| "editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?", | |
| "vim.leader": "<space>", | |
| "vim.normalModeKeyBindings": [ | |
| { | |
| "before": ["<leader>", "e"], | |
| "commands": ["workbench.view.explorer"] | |
| }, |
This file contains hidden or 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 stringToColor(string) { | |
| let hash = 0; | |
| let i; | |
| for (i = 0; i < string.length; i += 1) { | |
| hash = string.charCodeAt(i) + ((hash << 5) - hash); | |
| } | |
| let color = '#'; |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft,elem.offsetTop,elem.offsetWidth,elem.offsetHeight,elem.offsetParent
This file contains hidden or 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
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
NewerOlder