This is the portion of code through which I was playing
function Give({need}){
let type1={need===true?'chemist':'others'}
let type2={need}===true?'chemist':'others'
}
I read that The curly braces are a special syntax to let the JSX parser know that it needs to interpret the contents in between them as JavaScript instead of a string. So I was expecting both of these to work but only the second one is working even though inside brace in type1 I have javascript expression. I got this error, what does it even mean??
/App.js: Unexpected token, expected "," (4:17)
2 | ....
3 | function Give({need}){
> 4 | let type1={need===true?'chemist':'others'}
| ^
5 | let type2={need}===true?'chemist':'others'
6 | }
Can someone please help with the reason for this behavior?