Skip to content

Commit c84989e

Browse files
committed
refactor: use action when onChange is called
1 parent 79b4b64 commit c84989e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/stories/Hooks.story.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { action } from '@storybook/addon-actions';
21
import { Meta, Story } from '@storybook/react';
32
import { IntersectionOptions, InView, useInView } from '../index';
43
import { motion } from 'framer-motion';
@@ -80,6 +79,7 @@ const story: Meta = {
8079
table: {
8180
disable: true,
8281
},
82+
action: 'InView',
8383
},
8484
},
8585
args: {
@@ -96,10 +96,12 @@ const Template: Story<Props> = ({
9696
inlineRef,
9797
...rest
9898
}) => {
99+
// const onChange: IntersectionOptions['onChange'] = (inView, entry) => {
100+
// action('InView')(inView, entry);
101+
// }
99102
const { options, error } = useValidateOptions(rest);
100-
const { ref, inView, entry } = useInView(!error ? options : {});
103+
const { ref, inView } = useInView(!error ? { ...options } : {});
101104
const [isLoading, setIsLoading] = useState(lazy);
102-
action('InView')(inView, entry);
103105

104106
useEffect(() => {
105107
if (isLoading) setIsLoading(false);

0 commit comments

Comments
 (0)