@de-pa/React is a JavaScript library for building user interfaces. Added dependency injection design pattern base on react.
npm i @de-pa/react @de-pa/react-dom injection-js reflect-metadata --save
import { Component, IComponent, InjectionProvider } from '@de-pa/react';
import { render } from '@de-pa/react-dom';
class Service {
method() {
return 'hello world';
}
}
@IComponent()
class App extends Component {
constructor(public service: Service) {
super()
}
render() {
return <div>{this.service.method()}</div>
}
}
render(<InjectionProvider providers={[Service]}><App /></InjectionProvider>,document.body)
React has released two packages separately. It is very difficult to develop @de-pa/react based on react. So I think to develop a @de-pa/preact based on preact, welcome to use
@de-pa/React is MIT licensed.