A simple tic-tac-toe game implemented in React using MVVM (Model-View-ViewModel) architecture that utilizes react-obsidian for Dependency Injection.
The app demonstrates how dependency injection facilitates writing modular code that is easier to understand and test.
It's adapted from the Tic-Tac-Toe tutorial on the React website.
- MVVM Architecture - The app is structured in a way that separates concerns between the view, view model, and model.
- Dependency Injection - The app uses react-obsidian for dependency injection.
- "Dumb views" - The view is a simple component that only knows how to render the UI. It doesn't contain any business logic.
- No confusing
useEffect
hooks - hooks with dependency arrays can be confusing and hard to reason about. This repo demonstrates how to avoid hooks almost entirely by encapsulating logic in classes.
The repo contains two types of tests:
- unit - where single components are tested in isolation
- integration - where the entire app is tested as a whole. Services that interact with the system are mocked in the FrameworkGraphForIntegrationTests.
- yarn
- yarn dev