Skip to content

Instantly share code, notes, and snippets.

@selbekk
Created December 6, 2016 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selbekk/f7d8c9d267363d9ffaca6abd9120e054 to your computer and use it in GitHub Desktop.
Save selbekk/f7d8c9d267363d9ffaca6abd9120e054 to your computer and use it in GitHub Desktop.
Simple dependency injection
import React from 'react';
export default withDependencies(TargetComponent, dependencies) {
return function DependencyInjector(props) {
return <TargetComponent {...props} {...dependencies} />;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment