From 05aa25cd6af77bee17b1bc2a37d9b63086ab2005 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Thu, 19 Oct 2023 23:13:59 +0900 Subject: [PATCH] chore: rename --- packages/tiny-react/src/compat/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/tiny-react/src/compat/index.ts b/packages/tiny-react/src/compat/index.ts index a0e19c6d..6eedfba4 100644 --- a/packages/tiny-react/src/compat/index.ts +++ b/packages/tiny-react/src/compat/index.ts @@ -51,15 +51,15 @@ export function memo

( propsAreEqual: (prevProps: {}, nextProps: {}) => boolean = objectShallowEqual ): FC

{ function Memo(props: P) { - const prev = useRef(undefined); - if (!prev.current || !propsAreEqual(prev.current.props, props)) { - prev.current = { + const ref = useRef(undefined); + if (!ref.current || !propsAreEqual(ref.current.props, props)) { + ref.current = { type: NODE_TYPE_CUSTOM, render: Fc as FC, props, }; } - return prev.current; + return ref.current; } Object.defineProperty(Memo, "name", { value: `Memo(${Fc.name})` }); return Memo;