SolidJSS
SolidJSโ€ข12mo agoโ€ข
16 replies
snorbi

Solving "computations created outside ..." using `createMemo() ?`

I got the following warning because I used props.values in my event handling code:
computations created outside a createRoot or render will never be disposed

I have read the docs and some additional info (like https://github.com/solidjs/solid/issues/2130).
The warning is gone when I simply wrap the props.values access in a createMemo():
const values = createMemo(() => props.values)

My question is: is it a good solution?
If yes, then why the props accessors are not functions themselves (like props.values()instead of the current props.values) so they would always return a "fresh" value?

Thanks.
Was this page helpful?