The ModuleOrBlueprint which should be consumed by the component.
The provided toComponent | Component.
interface MyComponentProps {
firstName: string;
lastName: string;
}
export const MyComponent = provideModuleToComponent<MyComponentProps>(
MyComponentModule,
({ firstName, lastName }) => {
const service = useInject(MyComponentService);
return <h1>Hello {service.computeUserName(firstName, lastName)}!</h1>
}
);
function App() {
return <MyComponent firstName={'John'} lastName={'Doe'} />;
}
Can be used to easily provide a module to a component.
Note: An error will be thrown if a
globalmodule is provided.