Skip to content

Instantly share code, notes, and snippets.

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

  • Save marekpiechut/35673b3a96f50ff533238b3dd4acf712 to your computer and use it in GitHub Desktop.

Select an option

Save marekpiechut/35673b3a96f50ff533238b3dd4acf712 to your computer and use it in GitHub Desktop.
React-profiler
const App = () => {
const loadData = id => ({ id, value: 'some' })
const [_, setDummy] = useState()
return (
<div className="App">
<button onClick={() => setDummy(Date.now())} />
<SlowComponent
onClick={React.useCallback(() => loadData('dummy'), [])}
/>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment