01
Signal ownership matters
Signals are callable values with .set and .setValue. Keep request-specific state in a request or render owner; do not expose private data through mutable module singletons.
02
Derived data stays derived
Use computed for pure derivations, resource for async load state, and batch for one logical group of updates. Effects are for side effects and need cleanup ownership.
03
Bind a scalar target
Direct Signal reads can lower to text bindings. Use explicit bindText$, bindValue$, bindChecked$, bindDisabled$, bindHidden$, bindClass$, bindStyle$, bindHref$, bindSrc$, or bindAriaLabel$ when intent needs to be unambiguous.
const count = state(0)
const increment = () => count.set((current) => current + 1)
<button onClick$={increment}>
<output bindText$={count}>{count()}</output>
</button>PRACTICAL LABS
Run this capability.
Each example states the observable output, the boundary that remains your responsibility, and the check that proves the result.
01
Bind a scalar target
TSXimport { state } from '@mohammedaydan/core'
const busy = state(false)
<button bindDisabled$={busy}>Save</button>- OUTPUT
- Only the button disabled property changes when the Signal changes.
- BOUNDARY
- State in browser assets is public; never capture credentials or request-private values.
- PROVE IT
- Inspect data-nx-bind and confirm the component does not rerender.
02
Scope shared values explicitly
TypeScriptimport { createContextScope, createContext, provideContext } from '@mohammedaydan/core'
const Locale = createContext('en')
const root = createContextScope()
const french = provideContext(root, Locale, 'fr')
Locale.use(french) // fr- OUTPUT
- A child scope reads its own value without mutating the parent scope.
- BOUNDARY
- For async work pass an explicit ContextScope; Provider children are synchronous.
- PROVE IT
- Render two scopes with different values and assert isolation.
VERIFICATION
Prove the contract.
Inspect the output for binding markers, then change a Signal and confirm only the intended text or property changes.