Skip to main content

Field Lists with Arguments

Combining the argument and list notation will return an array.

export function UsersLimit({ limit }) {
const [p, q, { isLoading }] = usePq(handler)

const users = p
.listOf(`users(limit: ${limit})`)
.map(({ id, name }) => `${id}: ${name}`)

return (
<div>
{isLoading ? (
<span>loading...</span>
) : (
users.map((entry) => <span>{entry}</span>)
)}
</div>
)
}