import React, { Component } from 'react';
import { H, HComponent, Model, Ref, State, Prop, Watch } from 'q-reactive-react';
@HComponent()
export class Test extends Component {
@State() count = 1;
@State() input = 'ss';
@Prop() name;
@Watch('count')
onCountChange(newValue: number, oldValue: number) {
}
ref = React.createRef<any>();
inputRef = React.createRef<any>();
componentDidMount() {
console.log(this.ref, this.inputRef);
}
render() {
return (
<div>
<div
{...Ref(() => this.ref)}
onClick={() => {
this.count++;
}}
>
{H(() => this.count)}
{this.name}
</div>
<div>
{H(() => this.input)}
<input {...Ref(() => this.inputRef)} {...Model(() => this.input)} />
</div>
</div>
);
}
}