Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
I keep getting:Error: Invalid hook call. Hooks can only be called inside of the body of a function component

I've tried everything creating a separate function for a hook using npm link inside the react and the react-dom and even tried implementing hooks at different levels anyway here is the problem trying to use fuse I'm using visual studio enterprise

static renderForecastsTable(forecasts) {

  const [query, setQuery] = useState(''); // <-- problem line
  const fuse = new Fuse(forecasts, { keys: ['mjesto'] })
  const results = fuse.search(query);
  console.log(results);
  return (...)

  function handleOnSearch({ currentTarget = {} }) {
    const { value } = currentTarget;
    setQuery = value;
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hooks can only be called from functional components. You could refactor your code into a functional component like...

function ForecastsTable() {
  const [query, setQuery] = useState('');

  const handleOnSearch = () => {
    ...
  };

  return (
  );
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!