import { useUsersQuery, UsersQuery, Permission } from '../../graphql' import { useFormHandler, InputPropsOptions } from '../form/forms' import { useEffect } from 'react' interface UserInputProps { inputProps: (name: string, options?: InputPropsOptions) => any subtree: string } const UserInput = ({ inputProps, subtree }: UserInputProps) => { console.log('user input', inputProps('name', { subtree })) return ( ) } const initialData: UsersQuery = { users: [] } const UserAdmin = () => { const { data, error, loading } = useUsersQuery() const { inputProps, values, setValues } = useFormHandler(initialData) useEffect(() => { if (data) console.log('data', { ...data }) if (data && data.users) setValues({ ...data }) }, [data]) if (error) return

Error: {error.message}

if (loading) return

Loading...

return (
{ values.users.map((user, index) => ( user && )) }
Name Email Admin Instructor Interests Actions
) } export default UserAdmin