How to use this with functional component
Sajjad21990 opened this issue · 2 comments
Sajjad21990 commented
How to use this with functional component
carltheperson commented
Did you figure it out?
jerocosio commented
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();
}}
>