ghost-portal/packages/react-hooks/src/memo.ts
2020-09-17 16:46:46 +02:00

13 lines
431 B
TypeScript

// Copyright 2017-2020 @polkadot/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import createMemo from 'memoizee';
// Normalize via JSON.stringify, allow e.g. AccountId -> ss58
// eslint-disable-next-line @typescript-eslint/unbound-method
const normalizer = JSON.stringify;
export default function memo <T extends (...args: any[]) => any> (inner: T): T {
return createMemo(inner, { normalizer });
}