Skip to content

Commit

Permalink
fix: useUnmountEffect and useMountEffect typings fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Apr 21, 2021
1 parent 5f5e99a commit 32ec0c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/useMountEffect.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { EffectCallback, useEffect } from 'react';
import { useEffect } from 'react';

/**
* Run effect only when component is first mounted.
*
* @param effect effector to run on mount
*/
export function useMountEffect(effect: EffectCallback): void {
export function useMountEffect(effect: CallableFunction): void {
useEffect(() => {
effect();
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
4 changes: 2 additions & 2 deletions src/useUnmountEffect.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { EffectCallback, useEffect } from 'react';
import { useEffect } from 'react';

/**
* Run effect only when component is unmounted.
*
* @param effect effector to run on unmount
*/
export function useUnmountEffect(effect: EffectCallback): void {
export function useUnmountEffect(effect: CallableFunction): void {
useEffect(
() => () => {
effect();
Expand Down

0 comments on commit 32ec0c7

Please sign in to comment.