What is the reason of Parsing error:Unexpected token, in codesandbox project

422 Views Asked by At

I have

Parsing erros: Unexpected token, expected ","

in the project I code in codesandbox.io. I have just connected codesandbox project into github repository and it throws such error which I cannot figure-out. Can You please suggest what is wrong and how to fix it?

enter image description here

1

There are 1 best solutions below

0
On

Please don't post screenshots of code. It's usually actually faster to just copy-paste in your code, and you can use three backticks both above and below the code to format it correctly.

Trust your error messages to point you in the right direction: it's telling you that your exclamation mark is invalid. The ! is a non-null assertion operator, it doesn't belong there because you're not accessing a property that TS might think is null. The parser thinks you meant to do something like (rootElement, !someOtherThing), hence the error saying it expected a comma.