I want to call an API and extend the response by adding a new ‘category’ prop to each
categories [‘thirds’, ‘fifths’, ‘magic’]
- if the id is divisible by 3 => thirds
- if the id is divisible by 5 => fifths
- if the id is divisibly by 3 and 5 => magic
The url is https://jsonplaceholder.typicode.com/posts
How do i do that?
async function getData() {
const response = await fetch("https://jsonplaceholder.typicode.com/posts");
const data = await response.json();
}
{contacts.map((contact) => (
{contact.id}
{contact.userId}
{contact.title}
{contact.body}
))}