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
In Sinuous, you can't destructure props like this:
constComponent=({ name, intent, as, icon, onDrag, onDrop })=>{// Do something with propsreturn(<div>
...
</div>)}
It throws error simply because props is null.
So, you need to this instead:
constComponent=(props)=>{let{ name, intent, as, icon, onDrag, onDrop }=props||{}// Do something with propsreturn(<div>
...
</div>)}
In React you can do that, because React internally checks for null props and pass {} instead.
I plan to build a lot of components and this pattern is slightly annoying. Do you mind if I submit a PR?
Thank you
The text was updated successfully, but these errors were encountered:
Hey @luwes. I have been building something with this library for 2 weeks now and it's been great so far.
But, I notice a bit of unusual pattern when building components using JSX.
Since JSX transpiler always pass
null
ifprops
param is empty like:In Sinuous, you can't destructure
props
like this:It throws error simply because
props
isnull
.So, you need to this instead:
In React you can do that, because React internally checks for null
props
and pass{}
instead.I plan to build a lot of components and this pattern is slightly annoying. Do you mind if I submit a PR?
Thank you
The text was updated successfully, but these errors were encountered: