react-decoupler
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "react-decoupler", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Tommy Groshong <tom@groshong.software> (https://tommygroshong.com)", | ||
@@ -5,0 +5,0 @@ "description": "Simple Dependency Injection for React", |
@@ -35,3 +35,3 @@ # React Decoupler | ||
import { injector } from './services'; | ||
import { App } from './App; | ||
import { App } from './App'; | ||
@@ -232,3 +232,3 @@ ReactDOM.render( | ||
import { APIClient, calculateVehicleRange, TripManager } from './services; | ||
import { APIClient, calculateVehicleRange, TripManager } from './services'; | ||
@@ -467,3 +467,3 @@ // WAT?! No jest import mocking of axios or any react things?! | ||
<InjectServices deps={['funcKey', 'ServiceClass', 'val']}> | ||
{({ func, ServiceClas, val }) => { | ||
{([ func, ServiceClas, val ]) => { | ||
return <div />; | ||
@@ -482,6 +482,5 @@ }} | ||
Array service resolution keys: | ||
```javascript | ||
function App({ services }) { | ||
// Array service resolution keys: | ||
function AppServiceArray({ services }) { | ||
const [serviceA, serviceB] = services; | ||
@@ -491,17 +490,14 @@ return <div />; | ||
App.dependencies = ['AServiceKey', 'BServiceKey']; | ||
AppServiceArray.dependencies = ['AServiceKey', 'BServiceKey']; | ||
export const WrappedAppServiceArray = withServices(AppServiceArray); | ||
const WrappedApp = withServices(App); | ||
``` | ||
Object service resolution keys: | ||
```javascript | ||
function App({ serviceA, serviceB }) { | ||
// Object service resolution keys: | ||
function AppServiceObj({ serviceA, serviceB }) { | ||
return <div />; | ||
} | ||
App.dependencies = { serviceA: 'AServiceKey', serviceB: 'BServiceKey' }; | ||
AppServiceObj.dependencies = { serviceA: 'AServiceKey', serviceB: 'BServiceKey' }; | ||
const WrappedApp = withServices(App); | ||
export const WrappedAppServiceObj = withServices(AppServiceObj); | ||
``` | ||
@@ -508,0 +504,0 @@ |
612787
4
520