react-use-precision-timer
react-use-precision-timer copied to clipboard
Invalid hook call
Hi! I am trying to use this package and I am following the doc:
import React, { useState, useEffect, useRef, useCallback} from "react";
import { useDelay } from 'react-use-precision-timer';
import styles from ".././index.css";
import { usePlayer} from "@empirica/core/player/classic/react";
export function Fixation({is_practice = false}) {
const callback = useCallback(() => console.log('Boom'), []);
// Will call once after 1000ms.
const onceTimer = useDelay(1000, callback);
However I get this warning:
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
and error:
TypeError: Cannot read properties of null (reading 'useState')
I don't think the react versions are a problem:
npm ls react dyat_v3@ /Users/hh7792/Desktop/Dyat/dyat_v3 └─┬ [email protected] ├─┬ [email protected] │ └── [email protected] deduped ├─┬ [email protected] │ └── [email protected] deduped └── [email protected]
Anyone has any thoughts on what is going on?