I have a class Todolist that has objects of Projects class inside it.
I have created an object of Todolist and saved it to my localStorage.
static SaveDate(data) {
localStorage.clear();
localStorage.setItem("data", JSON.stringify(data))
}
here data is an object of class Todolist.
When I try to get back my data from local storage and save it into a new object of class Todolist.
static getData() {
const Todo = Object.assign(
new Todolist(),
JSON.parse(localStorage.getItem("data"))
)
return Todo;
}
I get a new Object of class Todolist and I can use its methods but I am not able to use the method of Project inside Todolist object. They are simple function objects not objects of a class Project.
How can I make them objects of the class Project?