You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a re-occurring issue where you cannot properly use props which are named the same as Javascript keywords (i.e. class, for, etc.). It seems the best workaround is to simply use the $$props syntax.
In my case, I am trying to the use for and class prop inside my reusable label component:
I am not sure what the svelte team can do as this seems like a language oversight, but I wish there was a way to easily extract these Javascript keyword-named props.
The text was updated successfully, but these errors were encountered:
jvanderen1
changed the title
Props as Keywords Errors
Javascript Keywords as Props - Error
Dec 19, 2021
There seems to be a re-occurring issue where you cannot properly use props which are named the same as Javascript keywords (i.e.
class
,for
, etc.). It seems the best workaround is to simply use the$$props
syntax.In my case, I am trying to the use
for
andclass
prop inside my reusablelabel
component:However, when running
eslint .
, I received the following error on both these guys:However, if I add the
<script>
tags at the top of the file, like so:I receive no errors.
I am not sure what the svelte team can do as this seems like a language oversight, but I wish there was a way to easily extract these Javascript keyword-named props.
The text was updated successfully, but these errors were encountered: