You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/docs/react/latest/memo.mdx
+20-28Lines changed: 20 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -48,51 +48,43 @@ var make = React.memo(function (props) {
48
48
In React, memo can accept an optional argument called "arePropsEqual". This function takes two arguments: the previous props and the new props of the component.
49
49
It should return true if the old and new props are the same, meaning the component will produce the same output and behavior with the new props as it did with the old ones.
50
50
51
-
In ReScript, to use the `arePropsEqual` function, you must redefine the `memo` binding.
51
+
In ReScript, to use the `arePropsEqual` function, you must redefine the `make` binding with `React.memoCustomCompareProps`.
52
52
53
53
<CodeTab>
54
54
55
55
```res
56
-
type propsDef = {
57
-
disabled: bool,
58
-
onClick: unit => unit,
59
-
}
60
-
61
-
// Refine memo to satify the compiler.
62
-
let memo = React.memoCustomCompareProps(_, (p1, p2) =>
0 commit comments