From some examples using near-sdk-as, I have seen that they use the @mutateState decorator, but I'm not sure what it does.
This is a snippet from the starter example on Learn NEAR:
// write the given value at the given key to account (contract) storage
@mutateState()
write(key: string, value: string): string {
storage.set(key, value)
return `✅ Data saved. ( ${this.storageReport()} )`
}
I saw from this answer on a different question that:
If the method is decorated with
@mutateStatethen the instance is written back to storage after the method call.
But I don't know what that means. I thought storage.set(key,value) would store the data without needing to use the decorator. Any help is appreciated