wox-team / wox-inject

React Dependency Injection library

Home Page:https://wox.so

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning This library is not production ready yet.



wox inject

An open source Dependency Injection library.



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>
  );
}

Installation

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

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.





About

React Dependency Injection library

https://wox.so

License:MIT License


Languages

Language:TypeScript 90.7%Language:MDX 5.5%Language:JavaScript 3.1%Language:HTML 0.7%