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
└─┬ react-use-precision-timer@3.5.5
├─┬ react-dom@18.3.1
│ └── react@18.3.1 deduped
├─┬ react-sub-unsub@2.2.7
│ └── react@18.3.1 deduped
└── react@18.3.1
Anyone has any thoughts on what is going on?
Hi! I am trying to use this package and I am following the doc:
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:
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
└─┬ react-use-precision-timer@3.5.5
├─┬ react-dom@18.3.1
│ └── react@18.3.1 deduped
├─┬ react-sub-unsub@2.2.7
│ └── react@18.3.1 deduped
└── react@18.3.1
Anyone has any thoughts on what is going on?