Skip to content

Instantly share code, notes, and snippets.

@EminQasimov
Last active August 9, 2021 11:07
Show Gist options
  • Save EminQasimov/f691b60c035a3d0cc6b3d1fe6c122986 to your computer and use it in GitHub Desktop.
Save EminQasimov/f691b60c035a3d0cc6b3d1fe6c122986 to your computer and use it in GitHub Desktop.
performance trick for intensive ui updates - react rerenders, inputs
let queued = false
textarea.addEventListener('input', () => {
if (!queued) {
queued = true
requestIdleCallback(() => {
updateUI(textarea.value)
queued = false
})
}
})
// link: https://nolanlawson.com/2021/08/08/improving-responsiveness-in-text-inputs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment