Skip to content

how to best use mergeProps in solidjs? #2245

Answered by anubra266
iyefrat asked this question in Q&A
Discussion options

You must be logged in to vote

Hiya, the only difference with the one from solid js is this part; where we apply some transforms.
Basically the props zag generates by default are not solidjs conforming, so this mergeProps from core is an adapter to make them solid compatible.

if (key === "style" || key === "class" || key === "className" || key.startsWith("on")) {
for (let i = 0; i < sources.length; i++) {
let s = sources[i]
if (typeof s === "function") s = s()
e = zagMergeProps(e, { [key]: (s || {})[key] })
}
return (e as any)[key]
}

As for your second question, we simply do it like the s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@iyefrat
Comment options

Answer selected by iyefrat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants