Skip to content

Commit

Permalink
Add TaskViewModel[ref: no-ref]
Browse files Browse the repository at this point in the history
  • Loading branch information
kuklinv committed Jan 25, 2025
1 parent 6f09dca commit e0bcff5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions React/mvvm-app/src/model/TaskViewModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useState } from "react";
import useTaskViewModel from "../model/TaskModel";

const TaskViewModel = () => {
const [taskModel] = useState(() => new TaskModel());
const addTask = (task) => {
taskModel.addTask(task);
};

const getAllTasks = () => {
return taskModel.getAllTasks();
};

return { addTask, getAllTasks };
};

export default TaskViewModel;

0 comments on commit e0bcff5

Please sign in to comment.