I have an app where I want to move the read, write operations to a utility file i.e. away from component. I am trying to do it this way.
component.js
imp
It looks like you need to bind setState before passing it to an external function.
setState
saveData(this.setState.bind(this), data);