I have an API that returns integers for an ID field. The API returns an array of objects
I'd like to lookup that ID in array and return the corresponding description in a table cell.
What's the best way to do this?
Example data is:
const demo = [{ "id": 1, "code": "AUD"}, {"id": 2, "code": "USD"]
I map through the API results to get each object as a row. In each row is an "id" field that I want to lookup.
I'd like to display in the Tablecell
the corresponding "code" of that ID but unsure best way to handle that. For example - if an object returns "id": 1, rather than display 1 in table, I'd like to show "AUD".
Any help would be greatly appreciated.
https://stackoverflow.com/questions/65768372/return-a-value-in-react-table January 18, 2021 at 11:13AM
没有评论:
发表评论