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
Replace the bind function with arrow function will allow it works like a callback.
saveData((newState) => this.setState(newState), data);