Gathering detailed insights and metrics for inversify-hooks
Gathering detailed insights and metrics for inversify-hooks
Gathering detailed insights and metrics for inversify-hooks
Gathering detailed insights and metrics for inversify-hooks
inversify-hooks-esm
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
@achmadk/inversify-hooks
inversify-react-context
Simple context provider and hooks for inversify
inversify-react-addons
An additional set of hooks for inversify-react to allow for safely getting items from a container.
Wrapper of inversify-props to inject your dependencies in the components, made with TypeScript using hooks.
npm install inversify-hooks
Typescript
Module System
Node Version
NPM Version
69.6
Supply Chain
90.7
Quality
75.7
Maintenance
100
Vulnerability
100
License
TypeScript (74.73%)
JavaScript (25.27%)
Total Downloads
171,475
Last Day
33
Last Week
1,730
Last Month
6,977
Last Year
66,233
MIT License
19 Stars
51 Commits
2 Forks
1 Watchers
20 Branches
1 Contributors
Updated on Feb 11, 2025
Minified
Minified + Gzipped
Latest Version
2.1.6
Package Id
inversify-hooks@2.1.6
Unpacked Size
9.56 kB
Size
3.70 kB
File Count
14
NPM Version
6.14.5
Node Version
12.18.2
Cumulative downloads
Total Downloads
3
1
This package is a wrapper of inversify-props to simplify how inject your dependencies in components with hooks.
$ npm install inversify-hooks reflect-metadata --save
The inversify-hooks type definitions are included in the inversify-hooks npm package.
import 'reflect-metadata'; // Import only once
import { container, useInject } from 'inversify-hooks';
container.addSingleton<IService1>(Service1);
function ExampleComponent() {
const [service1] = useInject<IService1>(cid.IService1);
useEffect(() => {
if (!service1) {
return;
}
service1.asyncMethod();
}, [])
}
container.addSingleton<IService1>(Service1, 'MyService1');
function ExampleComponent() {
const service1 = useInject<IService1>('MyService1');
}
:warning: Important! inversify-hooks requires TypeScript >= 2.0 and the
experimentalDecorators
,emitDecoratorMetadata
,types
andlib
compilation options in yourtsconfig.json
file.
1{ 2 "compilerOptions": { 3 "target": "es5", 4 "lib": ["es6"], 5 "types": ["reflect-metadata"], 6 "module": "commonjs", 7 "moduleResolution": "node", 8 "experimentalDecorators": true, 9 "emitDecoratorMetadata": true 10 } 11}
There are more examples of how to test in inversify-props
There are more examples of how to use the container in services or other components in inversify-props
You can learn more about why we made this packages in the original repo.
If you're not familizared of how to register dependencies, check the docs.
f you're using Uglify or Terser you need to configure well the plugin, check the docs.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
116 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
312.5%
33
Compared to previous day
Last Week
-7%
1,730
Compared to previous week
Last Month
7.8%
6,977
Compared to previous month
Last Year
75%
66,233
Compared to previous year