Warning This library is not production ready yet.
wox inject primary empowers React apps with a versatile dependency injection library, promoting an alternative paradigm to handle complexity.
@Injectable()
class FooService {
greet(msg: string) {
console.log(`hello ${msg}!`);
}
}
function App() {
const fooService = useResolve(FooService);
return (
<button onClick={() => {
fooService.greet('there!');
}}>
click me
</button>
);
}
Install @wox-team/wox-inject
in your project with your package manager of choice:
npm install @wox-team/wox-inject
yarn add @wox-team/wox-inject
pnpm add @wox-team/wox-inject
Right now the focus is to provide stability for SPA usage. SSR will be on the roadmap.
Want to contribute to wox inject? Our contributing guide has you covered.