Is it possible to output with specific index?

I want to get specific variable of amount.

Is it possible to say something, like: if index == 1 then return first amount? where possible amounts are: "3333" "444" "555"
If it is possible, how can I do it in the code?


const { data } = useQuery(ITEMS)

{, index) => ( <p>{items.amount}</p>))}

>Solution :

Yes, do this, and you can replace the 1 with whatever index you want (remember, indexing starts at 0, so this 1 means the second value. if you want the first, replace it with 0).


Leave a Reply