Start cleaning up the mess of useServer; make startup page update in real time

This commit is contained in:
Dane Everitt 2020-08-25 21:25:31 -07:00
parent 179885b546
commit c4418640eb
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
16 changed files with 175 additions and 61 deletions

View file

@ -0,0 +1,12 @@
import { DependencyList, MutableRefObject, useRef } from 'react';
import isEqual from 'react-fast-compare';
export const useDeepMemoize = <T = DependencyList> (value: T): T => {
const ref: MutableRefObject<T | undefined> = useRef();
if (!isEqual(value, ref.current)) {
ref.current = value;
}
return ref.current as T;
};