MVC-TSX (alpha version)
With MVC-TSX you can write imperative code for creating reactive applications.
import React from "react";
import * as ReactDOM from "react-dom";
import {Model, View, Controller, on, arg} from "mvc-tsx";
class LoginModel extends Model {
login: string = "";
password: string = "";
}
class LoginController extends Controller<LoginModel> {
@on("change", ".Login--loginInput")
onChangeLogin( @arg("target", "value") inputValue ) {
this.model.set({
login: inputValue
});
}
@on("change", ".Login--passInput")
onChangePassword( @arg("target", "value") inputValue ) {
this.model.set({
password: inputValue
});
}
@on("click", ".User--loginBtn")
onClickLogin() {
const {login, password} = this.model;
}
}
class LoginView extends View<LoginModel> {
controllers() {
return [
LoginController
];
}
template(loginModel: LoginModel>) {
return (<div className="Login">
<input className="Login--loginInput"/>
<input className="Login--passInput"/>
</div>);
}
}
const loginModel = new LoginModel();
ReactDOM.render(
<LoginView model={loginModel}/>,
document.getElementById("root")
);
Downloads
minify + React + EventEmitter + MVC
React + EventEmitter + MVC
minify + MVC
MVC
Examples
clock
counter
cart
TodoMVC