I have some data with questions and I want to print the list of them and before every question there should be an icon. There are three types of icons, depending of question type.
How I can do it? That way I get an error "Expected an assignment or function call and instead saw an expression". I tried to fix it in many ways and nothing works :(
render() {
const questions = questionsToChoose.map(q => {
const icon = q => {
if (q.isTrueFalse === true && q.isMultiple === false) {
return 'a';
}
else if (q.isTrueFalse === true && q.isMultiple === true) {
return 'b'
}
else if (q.isTrueFalse === false && q.isMultiple === false) {
return 'c'
}
};
<div key={q.id}>
<p>{icon} {q.content}</p>
</div>
});
return(
<div>{questions}</div>
)
}