thedevelobear/react-rewards

How to use this with functional component

Sajjad21990 opened this issue · 2 comments

How to use this with functional component

Did you figure it out?

You can do it with something like this:

const rewardRef = useRef();

  const callReward = () => {
    setTimeout(() => {
      rewardRef.current.rewardMe();
    }, 100);
  };

And on the button just call it:

       <button
          onClick={() => {
            callReward();
          }}
        >