Created
August 14, 2020 01:10
-
-
Save rhernandog/ef434fd56803225c5e7cc7921700c104 to your computer and use it in GitHub Desktop.
Implementation in the client side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Users = () => { | |
const [users, setUsers] = useState([]); | |
const [nameSearch, setSearchUserInput] = useState("ad"); | |
const [userTypeFilter, setUserTypeFilter] = useState("all"); | |
const [fetchUsers, { loading, error, data }] = useLazyQuery(ALL_USERS, { | |
variables: { | |
input: { | |
name: nameSearch, | |
userType: userTypeFilter | |
} | |
} | |
}); | |
useEffect(() => { | |
data && setUsers(data.allUsers); | |
}, [data]); | |
useEffect(() => { | |
fetchUsers(); | |
}, [nameSearch, userTypeFilter]); | |
return ( | |
<div> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment