Skip to main content
Version: 0.1.2

Function: setDIAdapter()

Imported from @react-logic/di

setDIAdapter(adapter): void

Install the DI adapter for the application. Call once before mounting React.

The default adapter (alien-signals + the built-in DI) registers itself automatically when @react-logic/di is imported, so most apps never call this. You only need it when you're swapping in a different adapter — e.g. createAngularAdapter(...) from @react-logic/angular-adapter to back react-logic with Angular's DI.

Calling this after logic classes have already been instantiated will leave those instances bound to the previous adapter — register early.

Parameters

Returns

void

Example

import { setDIAdapter } from '@react-logic/di';
import { createAngularAdapter } from '@react-logic/angular-adapter';

setDIAdapter(createAngularAdapter(angularRootInjector));
// …then mount React.