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;
}
}
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 (
);
}