Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@wox-team/wox-inject

wox-team40MIT1.2.2TypeScript support: included

Dependency injection for React

react di, react dependency injection, react, dependency injection, wox, wox team, wox-team, inject

readme

An open source Dependency Injection library.



Wox Inject empowers React apps with a versatile dependency injection library, promoting an alternative paradigm to handle complexity.

import { Injectable } from '@wox-team/wox-inject';

@Injectable()
class GreeterService {
  greet(val: string) {
    console.log(val);
  }
}

function App() {
  const greeterService = useResolve(GreeterService);

  return (
    <button type="button" onClick={() => greeterService.greet('hello!')}>click me</button>
  );
}

Getting Started

Visit wox.so to get started with Wox Inject.


What about SSR?

Right now the focus is to provide stability for SPA usage. SSR will be on the roadmap.


Contributing

Want to contribute to wox inject? Our contributing guide has you covered.