-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d121eb
commit f925b5d
Showing
15 changed files
with
523 additions
and
281 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# Performance | ||
|
||
Влияние React memo useCallback useMemo на производительность | ||
Влияние React memo useCallback useMemo на производительность | ||
|
||
[When to useMemo and useCallback](https://kentcdodds.com/blog/usememo-and-usecallback) | ||
[Should You Really Use useMemo in React? Let’s Find Out.](https://medium.com/swlh/should-you-use-usememo-in-react-a-benchmarked-analysis-159faf6609b7) | ||
[Blogged Answers: A (Mostly) Complete Guide to React Rendering Behavior -> Memoize Everything?]( | ||
https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior#memoize-everything) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {Profiler, useEffect, useState} from 'react'; | ||
|
||
|
||
const Child = () => { | ||
const [, setState] = useState(); | ||
|
||
useEffect(() => { | ||
setInterval(() => setState({}), 100) | ||
}, []) | ||
|
||
console.count('Child'); | ||
|
||
return ( | ||
<div> | ||
Child | ||
</div> | ||
) | ||
} | ||
|
||
const Component = () => { | ||
console.count('Component'); | ||
|
||
return ( | ||
<div> | ||
<Child/> | ||
</div> | ||
) | ||
} | ||
|
||
const Test = () => { | ||
console.count('Test'); | ||
|
||
return ( | ||
<Profiler id="test" onRender={(id, phase, duration) => console.count('profiler')}> | ||
<Component/> | ||
</Profiler> | ||
) | ||
} | ||
|
||
|
||
export default Test; |
This file contains 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
This file contains 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
Oops, something went wrong.