-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Memo
- Loading branch information
Showing
4 changed files
with
35 additions
and
14 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
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,17 @@ | ||
import React from "react"; | ||
|
||
function MemoComp({ name }) { | ||
console.log("Memo Component"); | ||
return <div>{name}</div>; | ||
} | ||
|
||
export default React.memo(MemoComp); | ||
|
||
// Memo Component | ||
/* | ||
Pure Component work with class base component do same thing in function component using React.memo | ||
Using memo will cause React to skip re-rendering a component if its props have not changed. | ||
All do in export default React.memo(pass component as argument) | ||
React.memo is high order component. | ||
It is similar to React pure component but it works in function component. | ||
*/ |
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