Skip to content

Instantly share code, notes, and snippets.

@marekpiechut
Created June 22, 2021 10:52
Show Gist options
  • Select an option

  • Save marekpiechut/1b8f10e62c7892cd8f3a5a347271460f to your computer and use it in GitHub Desktop.

Select an option

Save marekpiechut/1b8f10e62c7892cd8f3a5a347271460f to your computer and use it in GitHub Desktop.
React-profiler
const SlowComponent = React.memo(({ text, onClick }) => {
const arr = []
for (var i = 1000000 - 1; i >= 0; i--) {
arr.push(i)
}
return (
<div>
<div>I'm slow {text}</div>
<button onClick={onClick}/>
</div>
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment