Code:
let appState = observable({
time: 11,
do:function(){
appState.time=12
}
});
const App = observer(class app extends React.Component {
componentDidUpdate(){
console.log("1")
}
render(){
return (<h2 onClick={appState.do}>Home{appState.time}</h2>;
}
})
ReactDOM.render(
<App/>,
document.body
);
does not actually update to data using action decorations, using action decorations:
let appState = observable({
time: 11,
do: action(function () {
appState.time = 12;
})
})
action is equivalent to setState. Why is action still updated without enabling it