Add useSelf
to store system, update self only, exclude children components, for example:
define('my-app', class extends WeElement {
useSelf() {
return ['msg']
}
render() {
return (
<div>
<span onClick={this.store.random}>{this.store.data.msg}</span>
<my-counter />
</div>
)
}
})
render(
<my-app />,
'body',
new class Store {
data = {
msg: 'aaa',
count: 0
}
sub = () => {
this.data.count--
}
add = () => {
this.data.count++
}
random = () => {
this.data.msg = Math.random()
}
}()
)