width:calc(100% - scrollbar-width)
。export type MemoChildrenProps = {
shouldUpdate: boolean;
children: React.ReactNode;
};
export default React.memo(
({ children }: MemoChildrenProps) => children as React.ReactElement,
(_, { shouldUpdate }) => !shouldUpdate
);
// 这个时使用就当component 组件用.
<MemoChildren shouldUpdate={visible || forceRender}>
{modalRender ? modalRender(content) : content}
</MemoChildren>;
原文:https://www.cnblogs.com/kongshu-612/p/14924442.html