Skip to content

Commit

Permalink
chore: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 19, 2023
1 parent 7f4103d commit 05aa25c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/tiny-react/src/compat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ export function memo<P extends {}>(
propsAreEqual: (prevProps: {}, nextProps: {}) => boolean = objectShallowEqual
): FC<P> {
function Memo(props: P) {
const prev = useRef<VCustom | undefined>(undefined);
if (!prev.current || !propsAreEqual(prev.current.props, props)) {
prev.current = {
const ref = useRef<VCustom | undefined>(undefined);
if (!ref.current || !propsAreEqual(ref.current.props, props)) {
ref.current = {
type: NODE_TYPE_CUSTOM,
render: Fc as FC<any>,
props,
};
}
return prev.current;
return ref.current;
}
Object.defineProperty(Memo, "name", { value: `Memo(${Fc.name})` });
return Memo;
Expand Down

0 comments on commit 05aa25c

Please sign in to comment.