JSFiddle - React, Tailwind, and code Playground
Babel + JSX
// import { observable } from 'dob'
// import { Connect } from 'dob-react'
@observable
class ArticleAction {
title = "我是标题党"
@Action changeTitle() {
this.title = "改变了"
}
}
@Connect({
store: new ArticleAction()
})
class Article extends React.Component<any, void> {
componentWillMount() {
setTimeout(() => {
this.props.store.changeTitle()
}, 1000)
}
render() {
return (
<div>{this.props.store.title}</div>
)
}
}
ReactDOM.render(<Article />, document.getElementById("react-dom"))