Skip to main content

React Bindings

A set of bindings have been created to simplify usage of TypeDI within React applications.

danger

The React hooks are currently in beta, and the API surface could change at any time. They may also contain bugs.

If you wish to use them in a production application, please consider locking the package version used to prevent future updates from making unexpected changes.

These bindings consist of the following hooks:

  • useService
  • useServiceOrNull
  • useContainer
  • useTreeVisitor

useService

This hook is rather simple: it gets a service with a specific identifier from within a specified container which, by default, is the default container instance.