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 Lohr3y ago
You need to put the wrapper outside both store and effect.
musiclover
musicloverOP3y ago
Hmm.. So whenever I add new createEffect, Do I always have to wrap createRoot? I have a lot of createEffect....
Alex Lohr
Alex Lohr3y ago
Just have one createRoot around all of your external state and effects. Like export const { ... } = createRoot(() => { return { ... } })
musiclover
musicloverOP3y ago
Thanks alex. Like this?
Alex Lohr
Alex Lohr3y ago
That should work.
Want results from more Discord servers?
Add your server