Skip to content

Instantly share code, notes, and snippets.

@rhernandog
Created August 14, 2020 01:10
Show Gist options
  • Select an option

  • Save rhernandog/ef434fd56803225c5e7cc7921700c104 to your computer and use it in GitHub Desktop.

Select an option

Save rhernandog/ef434fd56803225c5e7cc7921700c104 to your computer and use it in GitHub Desktop.

Revisions

  1. rhernandog created this gist Aug 14, 2020.
    26 changes: 26 additions & 0 deletions Users.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    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>
    );
    };