ghost-portal/packages/react-hooks/src/memo.ts
Jaco Greeff 304dab95cc
Add React.memo to some components (#2375)
* Add React.emomo to some components

* Linting
2020-03-12 11:15:38 +01:00

14 lines
506 B
TypeScript

// Copyright 2017-2020 @polkadot/react-hooks authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
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 Function> (inner: T): T {
return createMemo(inner, { normalizer });
}