Working with Signalish props #4887
Replies: 2 comments 3 replies
-
Only if you want to accept signals & unwrapped values both, and need to consume the raw value in some way (i.e., not passing it straight on into a JSX attribute or as a JSX child). If it's too much of a hassle for you then you don't need to accept signals of course, though you won't be able to piggyback our types as much. I realize that's probably not the answer you're hoping for but there's not much in the way around it if you want to accept both & have to read the value; gotta check & unwrap. |
Beta Was this translation helpful? Give feedback.
-
@rschristian do you know, is it normal to have components using signals to only accept a signal props? TBH dealing with both wrapped and unwrapped props is pretty painful... I wonder if it would be possible to hook into preact internals and make all props signals (if they aren't passed in as signals)... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Basically all the html attributes are typed as
Signalish<T>
, for examplearia-disabled
isSignalish<Booleanish | undefined>
. Do you need to check if a prop is a signal every time you do something with it in a component? It seems kinda cumbersome and I feel like I'm missing something.Below is an example
Beta Was this translation helpful? Give feedback.
All reactions