I am trying to referencea js file in ts file but it does not seem to be working. I am getting error in console. Any clues? https://stackblitz.com/edit/angular-or3v1z
Im making a fetch to an API and get an array of objects as a result, can I modify this before adding it to my react state, or do I add it to the state, and then create another state for the modified objects?
{
category:"Cars",
question:"Which one is a car?",
answers:[
{
answer:"Apple",
isCorrect:false
},
{
answer:"Pizza",
isCorrect:false
},
{
answer:"Lamp",
isCorrect:false
},
{
answer:"BMW",
isCorrect:true
}
]
}
Nice, thank you :) Had to use an online json formatter for this to work
So, can I modify the incoming data, the first one into looking like the second one before adding it to my state array, or should I create another state and modify it in there instead?
Hello all, I noticed JS [code](https://stackoverflow.com/a/58031173/2924577) where the condition in [some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) method kept changing while iterating through the array.
Though it is allowed and works, it didn't feel semantically right. What do you think about it? Is is a good practice to do that?