I am playing around with some react code, and observed unexpected (to me) behaviour. Can someone please explain whats going on?
export default function AnswerBox(props: any) {
const before = props.answers;
console.log('const before ', before);
props.answers.map((value: any) => {value.selected = 'asdfasdfasdf'})
console.log('answer props after' , props.answers);
Both of the log lines show an array of objects with 'selected':'asdfasdfasdf'
Is there some tricky async business I'm missing here? Thanks in advance.