# Wire The ViewModel To The DRE Store

> Understand the ViewModel's role in the DRE architecture pattern.

- URL: https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/03-state-machine-mvvm/lesson-04-wire-viewmodel-with-store
- Course: [Mobile Action Pro](https://dantech.academy/en/courses/kotlin-accelerator.md)
- Module: State Machine and MVVM
- Duration: 12 min
- Difficulty: intermediate
- Access: Enrolled students
- Tiếng Việt: https://dantech.academy/courses/kotlin-accelerator/engineer-builder/03-state-machine-mvvm/lesson-04-wire-viewmodel-with-store.md

## Objectives

- Wire the ViewModel as a composition boundary instead of turning it into a second reducer
- Bring async results back into the state machine by dispatching result actions from executeAsyncOp

## In this lesson

1. Lesson Goal
2. Part 1: What Role Does The ViewModel Play In The DRE Pattern?
3. Part 2: How DRE Handles The Submit Answer Logic
4. Part 3: executeAsyncOp Brings Results Back As Actions
5. Part 4: Derive Render State, Keep One-Time Events Separate
6. Part 5: ensureGameStarted And The Route's Lifecycle
7. Code Reading Path
8. Bad Smells
9. Key Takeaways

## Study with an AI agent

The full lesson is for students of this course. Students open the lesson on the web and press **Markdown** to copy all of it, then paste it into Claude, ChatGPT, Cursor or whichever agent you use. Faster: mint a token at `/profile/ai-agents` and your agent reads lessons over MCP.

- [Join the course](https://dantech.academy/en/kotlin-accelerator/checkout)

---

- Previous lesson: [Read The Game State Machine's Real Reducer](https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/03-state-machine-mvvm/lesson-03-read-game-state-machine.md)
- Next lesson: [Keep Side Effects Outside The Reducer](https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/03-state-machine-mvvm/lesson-05-keep-side-effects-outside-reducers.md)
