Action

    @action

    action은 observable state를 update시키는 요인이 된다. 마치 Redux action 과도 같은 의미이다. 지금까지 observable에 proxy라고 하는 패턴을 사용해 state를 변경했다. 그러면 왜 action을 사용해야 할까? 이전 소스코드를 살짝 변경해 보자 1번째 방법 // app.js function App() { const personStore = useContext(PersonContext); const age10 = computed(() => { return Math.floor(personStore.age / 10) * 10; }).get(); console.log(personStore.age, personStore.name); const click = () =>..