Socket
Socket
Sign inDemoInstall

inversify-hooks

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inversify-hooks

Wrapper of inversify-props to inject your dependencies in the components, made with TypeScript using hooks.


Version published
Weekly downloads
1.2K
increased by37.32%
Maintainers
1
Weekly downloads
 
Created
Source

Inversify Props

This package is a wrapper of inversify-props to simplify how inject your dependencies in components with hooks.

GitHub last commit GitHub license GitHub forks GitHub contributors GitHub issues

Installation

npm install --save inversify-hooks

Usage

container.addSingleton<IService1>(Service1);
container.addSingleton<IService2>(Service2);

function ExampleComponent() {
  const service1 = useService<IService1>('IService1');
}

Why we made this package

You can learn more about why we made this packages in the original repo.

How register a dependency

If you're not familizared of how to register dependencies, check the docs.

How to use in your components

Once your dependencies are registered in the container, is simple use the hook to get the dependency.

function ExampleComponent() {
  const service1 = useService<IService1>('IService1');
}

How to configure uglify

If you're using uglify or similar you need to configure well the plugin.

Next steps

  • Remove id param, and use magic id like in inversify-props.

Keywords

FAQs

Package last updated on 10 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc