Open andrewvy opened 8 years ago
const Store = fad.createStore()
const Post = Store.createModel('post', {
propTypes: {
name: fad.PropTypes.string,
content: fad.PropTypes.string
}
})
let blogPost = new Post()
let PostComponent = (props) => {
<div className='post'>
<div className='postTitle'>{props.post.title}</div>
<div className='postContent'>{props.post.content}</div>
</div>
}
let render = (post) => {
ReactDOM.render(<PostComponent post={post} />, mountNode)
}
blogPost
.stream('*')
.subscribe(render)
blogPost.set('Hello world!')
An example w/ React stateless components.