One consideration, though. You might want to make your function in a way that will be easier to consume. You know that you'll be using it in a map() to convert the endpoint return.
Here is a simplified example of your endpoint result:
const result = [
{
"data":"08/03/2024",
"valor":"0.041957",
}
];
With your current implementation, you'll have to consume it like this:
One consideration, though. You might want to make your function in a way that will be easier to consume. You know that you'll be using it in a
map()
to convert the endpoint return.Here is a simplified example of your endpoint result:
With your current implementation, you'll have to consume it like this:
If you change your method's signature to the example below,
you'll be able to consume it like this:
What do you think?