i've got this error while i was using react-apollo with the graphql api made with nestjs, i have tried first componentwillmount()

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 hooksyou might have more than one copy of react in the same app

so i have fixed like is shown in the code below:


import { uselazyquery, usemutation } from '@apollo/client'
import react, { useeffect, usestate } from 'react'
import {  get_all_projects } from '../graphql/queries'
function home() {
    const [getemployees, { loading, data, error }] = uselazyquery(get_all_projects,
            variables: {}

    if (error) {
    if (data) {
    useeffect(() => {
            }, []);
return (
        <div classname="home">...</div>

export default home

Related Query

More Query from same tag