Sanity App SDK
    Preparing search index...
    • Retrieves a single user by ID for a given resource (either a project or an organization).

      Parameters

      • options: GetUserOptions

        The user ID, resource type, project ID, or organization ID

      Returns UserResult

      The user data and loading state

      const { data, isPending } = useUser({
      userId: 'gabc123',
      resourceType: 'project',
      projectId: 'my-project-id',
      })

      return (
      <div>
      {isPending && <p>Loading...</p>}
      {data && (
      <figure>
      <img src={data.profile.imageUrl} alt='' />
      <figcaption>{data.profile.displayName}</figcaption>
      <address>{data.profile.email}</address>
      </figure>
      )}
      </div>
      )