Signals in global scope vs component scope.

Is there a preferred way or best practice in handling state for components? Should we try to keep components pure? In one of my applications, I have signals declared outside of components, making them global. Is there an disadvantage to doing this or should I aim to pass the signals as props? https://www.solidjs.com/tutorial/stores_nocontext
SolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
1 Reply
bigmistqke
bigmistqke5mo ago
If u don't use ssr this pattern is fine. It is called a singleton and it's my go-to state solution.
Is there a preferred way or best practice in handling state for components? Should we try to keep components pure?
Since there are no performance pitfalls when having state in or out a component there are less 'best practices' in solidjs. It's up to you how you want to architect your application.
Want results from more Discord servers?
Add your server