import AlminReactContainer from "../almin-react-container" ; import * as React from "react" ; import * as ReactDOM from "react-dom" ; import { Dispatcher , Context , Store , StoreGroup } from "almin" ; class MyState { value : string ; constructor ( { value } ) { this . value = value ; } } class MyStore extends Store < MyState > { state : MyState ; constructor ( ) { super ( ) ; this . state = new MyState ( { value : "Hello World!" } ) ; } getState ( ) { return this . state ; } } const storeGroup = new StoreGroup ( { myState : new MyStore ( ) } ) ; const context = new Context ( { dispatcher : new Dispatcher ( ) , store : storeGroup } ) ; type AppState = typeof storeGroup . state & { custom ? : string ; } ; class App extends React . Component < AppState , { } > { render ( ) { return < div > { this . props . myState . value } < /div>; } } const RootContainer = AlminReactContainer . create ( App , context ) ; console . log ( RootContainer ) ; ReactDOM . render ( < RootContainer />, document.body); ReactDOM . render ( < RootContainer custom = { "value" } / > , document . body ) ; React . createElement ( RootContainer ) ; React . createElement ( RootContainer , { custom : "value" } ) ;