I'm a bit new to react, so don't bully me hard. I got to solve this until tomorrow as my homework, and I thought you could help me with it.
Got a task which sounds like:
{
"valid": true,
"timestamp": 1582195447,
"base": "USD",
"rates": {
"AED": 3.67338,
"AFN": 77.8079,
"ALL": 113.23065,
"AMD": 478.14251
}
}
I am familiar with the flexbox tech, but I simply don't understand how to do part one. Despite I am familiar with promise/response in vanilla js, I know how to retrieve data from the API (like ships, planets, and stuff from starWarsApr for example), what I don't know is how to do it with this kind of object and with the usage of create-react-app.
Can you be so kind and maybe supply me with the link to materials about such staff, or to solve and explain to me how is this can be done. I don't have any friends front-end developers to explain to me such things, so I am sorry to ask.
Sincerely, I don't understand the goal of React in this exercice (maybe for ES6 setup).
The part one is quite simple, just create a Promise
that returns the object asked for:
const promise = new Promise((resolve) => {
resolve({
valid: true,
timestamp: 1582195447,
base: 'USD',
rates: {
AED: 3.67338,
AFN: 77.8079,
ALL: 113.23065,
AMD: 478.14251,
},
});
});
If you want to learn more about promises, check these links: