Closed nojaf closed 3 months ago
@nojaf is attempting to deploy a commit to the ReScript Association Team on Vercel.
A member of the Team first needs to authorize it.
@fhammerschmidt any suggestions?
(Also, apologies for my impatience 😅)
I think the arePropsEqual
example can be simplified by shadowing the make function:
@react.component
let make = (~disabled, ~onClick) => {
<button
disabled={disabled}
onClick={ev => ev->JsxEvent.Mouse.preventDefault->onClick}>
{React.string("My button")}
</button>
}
let make = React.memoCustomCompareProps(make, (p1, p2) =>
p1.disabled == p2.disabled
)
Playground Link no explicit typing of props needed either, but I never used that personally.
Oh that does seem simpler. My original example was based on https://forum.rescript-lang.org/t/looking-for-a-react-memo-example/1144/12?u=nojaf
I'll revisit the docs.
Nice work!
A lot of text comes from https://react.dev/reference/react/memo#memo. The important thing for me is the
arePropsEqual
example. Let me know if you like to see anything different.