Warning computations created outside a `createRoot`....

I have a code like this. Wrapping store using createRoot doesn't solve this. 'createEffect' actually makes the warning. How to solve it?
5 Replies
Alex Lohr
Alex Lohr2y ago
You need to put the wrapper outside both store and effect.
musiclover
musicloverOP2y ago
Hmm.. So whenever I add new createEffect, Do I always have to wrap createRoot? I have a lot of createEffect....
Alex Lohr
Alex Lohr2y ago
Just have one createRoot around all of your external state and effects. Like export const { ... } = createRoot(() => { return { ... } })
musiclover
musicloverOP2y ago
Thanks alex. Like this?
Alex Lohr
Alex Lohr2y ago
That should work.
Want results from more Discord servers?
Add your server