React Scheduler - MobX Tutorial
This tutorial shows how to render DHTMLX React Scheduler in a Vite + React + TypeScript app and drive it from a MobX store. By the end, you'll have a working Scheduler that supports create/update/delete, view + date navigation, snapshot-based undo/redo for event changes, and a read-only toggle.
примечание
The complete source code is available on GitHub.
You will build:
- a MobX store that owns
events, currentviewanddate - a
data.savebridge that converts Scheduler edits into store actions - a simple toolbar (views, navigation, undo/redo, read-only toggle) that sits above the Scheduler
Prerequisites
- Basic knowledge of React, TypeScript, Vite, and MobX
- Recommended: read Data Binding & State Management Basics to understand the data binding mode and the
data.savecallback this tutorial builds on.
Quick setup - create the project
In this step we will create a Vite project, install dependencies, and verify the app runs.
Actions:
- Create a Vite React + TypeScript project
- Install MobX + UI dependencies
- Install React Scheduler (trial package)
- Remove Vite's default
App.cssstyles so Scheduler can fill the viewport
Before you start, install Node.js.
Create a Vite React + TypeScript project:
npm create vite@latest react-scheduler-mobx-demo -- --template react-ts
cd react-scheduler-mobx-demo
Now install the required dependencies.
- For npm:
npm install mobx mobx-react-lite @mui/material @mui/icons-material @emotion/react @emotion/styled
- For yarn:
yarn add mobx mobx-react-lite @mui/material @mui/icons-material @emotion/react @emotion/styled