Skip to content

Instantly share code, notes, and snippets.

@marekpiechut
Created June 22, 2021 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marekpiechut/3ba9de1720dcef2a571121d62bca40be to your computer and use it in GitHub Desktop.
Save marekpiechut/3ba9de1720dcef2a571121d62bca40be 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