Derived value in event handler causing router error
Error: Make sure your app is wrapped in a <Router /> when calling an eventhandler. Just trying to log a derived signal/prop in my
buy
function. The values from product()
get printed correctly in my DOM
The second console.log
works fine. But the first throws
7 Replies
Ok so wrapping it in
createMemo
fixed it. const product = createMemo(() => props.product)
. Is this the correct way to do this?i don't understand the reason for the error so I can't help with that but why do you need a derived signal for that? why not just use props?
dont wanna do props.product everywhere, sort of alternate to props destructuring
doing props.* everywhere is how Solid intends props to be used. If you prefer destructuring, you could always check out the solid primitive for that https://primitives.solidjs.community/package/destructure#spread-component-props
Solid Primitives
A library of high-quality primitives that extend SolidJS reactivity
@uchiha_savior
I'll check it out. Thanks
i also see this from time to time, clearing nod mods seems to help sometimes