Skip to content

Instantly share code, notes, and snippets.

@rhernandog
Created August 14, 2020 01:10
Show Gist options
  • Save rhernandog/ef434fd56803225c5e7cc7921700c104 to your computer and use it in GitHub Desktop.
Save rhernandog/ef434fd56803225c5e7cc7921700c104 to your computer and use it in GitHub Desktop.
Implementation in the client side
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