Skip to content

Instantly share code, notes, and snippets.

@rhernandog
Created August 14, 2020 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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