This is the first time I am trying to build a real layout for my ReactJS project, but I ran into this error (Error ',' expected.ts(1005)) and can not get it off. Here is the html of the layout I intend to build:
<div>
{selectedInput === null ? (
<div>
<div>
some html
</div>
<div>
{
array.slice(3, 100).map((doc, index) =>
<div>
some html
</div>
} <== here the error
</div>
</div>
) : (
<div>
some html
</div>
)
}
</div>
I encounter the error in the last brace
EDIT: I apologize to whoever replied, but I wanted to synthesize the code and I did a horrible job. Now I have put the correct version.
You missed the closing parenthesis)
of map
.
Try adding parenthesis.
Updated code:
<div>
{selectedInput === null ? (
<div>
<div>some html</div>
<div>
{array.slice(3, 100).map((doc, index) => (
<div>some html</div>
))}
</div>
</div>
) : (
<div>some html</div>
)}
</div>