Field Lists with Arguments
Combining the argument and list notation will return an array.
- Bracket Keys
- Params Function
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>
)
}
export function UsersLimit({ limit }) {
const [p, q, { isLoading }] = usePq(handler)
const users = p
.listOf('users')
.$({ limit })
.map(({ id, name }) => `${id}: ${name}`)
return (
<div>
{isLoading ? (
<span>loading...</span>
) : (
users.map((entry) => <span>{entry}</span>)
)}
</div>
)
}