ERROR [SyntaxError: Unexpected EOF]
Closed this issue · 2 comments
So I figured out this lib few days ago and I'm already falling in love with it.❤ But I recently ran into a problem and In order to contribute a bit with the communit I just want to share this little problem and the solution I got.
The problem:
The erro is: SyntaxError: Unexpected EOF
I got this by just adding // @solid
at the begining of the file. This error occurs once I save the file and doesnt let me run the app at all at any point.
After sometime removing some of the code, I figured out that you can't have a break line like this, This was an easy fix but I wasnt expecting that would break in solid cause it works fine without it. Is there any chance we get an update for this in future?
I would love to make a PR with the fix for this If I did know how ;p
I'm glad you're liking it so far!
Looks like Solid itself doesn't support this JSX syntax.
However, it's worth noting that in react, that label would have the string "...\n ..."
, which I doubt is what you want?
I would recommend using something like
<Image
accessibilityLabel="...\
..."
which will work correctly in Solid, although react will treat it as "...\\\n..."
.
In general, React treats strings in JSX somewhat like HTML, while Solid treats them like usual JS strings. Personally, I think the latter is much easier to work with, as it means that – in solid – foo="bar"
is identical to foo={"bar"}
– but this is not the case in React.
Tl;dr: Solid treats strings in JSX identically to JS strings, and so this errors because it isn't a valid string in JS. This isn't a bug, just a difference in the treatment of JSX.
That will works accessibilityLabel="...\
thanks for clarify me this ;)