Skip to content

Commit

Permalink
refactor: refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Myssak committed Aug 14, 2020
1 parent 140b00b commit bd2deb7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/min.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/hocs/withWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import React from 'react';
const withWindow = <T extends {}>(
Component: React.ComponentType<T>,
): ((props: T) => JSX.Element | null) => (props: T): JSX.Element | null => {
if (typeof window === 'undefined') {
return null;
}
if (typeof window === 'undefined') return null;

return <Component {...props} />;
};
Expand Down
6 changes: 2 additions & 4 deletions src/hooks/useWindowSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ const useWindowSize = ({ height, handleHeight }: IProps): void => {
});

useEffect(() => {
if (!isClient) {
return;
}
if (!isClient) return;

const handleResize = () => {
const handleResize = (): void => {
const { height: windowHeight } = getSize();

if (windowHeight && windowHeight !== height) {
Expand Down

0 comments on commit bd2deb7

Please sign in to comment.