Variable: inject
Imported from
@react-logic/di
constinject:InjectFn
Defined in: di/src/lib/inject.ts:33
Inject a dependency from the current injection context. Must be called synchronously during a logic class or service constructor.
Type Param
The type the token resolves to.
Type Param
The options shape. When { optional: true }, the return
type widens to T | null; otherwise it's T.
Example
class MyLogic {
service = inject(MyService);
}