{"repo":"wix-incubator/obsidian","free":true,"listed":false,"github":"https://github.com/wix-incubator/obsidian","clone":"git clone https://github.com/wix-incubator/obsidian.git","description":"Dependency injection library for TypeScript and React applications","language":"TypeScript","stars":157,"topics":["dependency-injection","react","react-native","typescript","dependency-inversion","ioc","ioc-container","dagger","dagger-hilt","hilt"],"license":null,"category":"mobile-apps","readme_excerpt":"Obsidian React Obsidian is a dependency injection framework for React and React Native applications. It allows you to inject dependencies into hooks, components, and classes. Separating the construction and consumption of dependencies is crucial to maintaining a readable and testable codebase. 📖 Read more about Dependency Injection and Obsidian in Breaking complexity with Dependency Injection: Introducing Obsidian on Medium. Documentation Getting Started Installation Guides Chat on Discord Example - Injecting a hook Obsidian supports injecting hooks, components and classes. The example below shows how to inject a hook. Step 1: Declare an object graph Before we can inject dependencies into hooks, components and classes, we first need to declare our dependencies. Dependencies are declared in classes called \"Graphs\" where the relationships between the dependencies are outlined. In the ApplicationGraph below, we declare two dependencies: 1. httpClient 2. biLogger Both functions are annotated by the @Provides() annotation. This signals Obsidian that the results of these functions are provided by the graph and can be injected. Notice how the biLogger function receives an httpClient as an argument. This means that biLogger is dependent on httpClient . Obsidian will create an httpClient when biLogger is injected. Step 2: Inject a dependency Step 3: Use the injected hook Now that we exported the injected hook, we can use it in a component without needing to provide its dependencies m","default_branch":null,"files":null,"tree":[],"storefront":"/r/wix-incubator","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/wix-incubator/obsidian/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}