It's a bit of a guess because you're not specifying what exactly doesn't work, but I'm guessing you're getting something like this.setState is not a function.
That's because this isn't the React component inside your callback function. There's basically two ways to fix this
// Bind the current this to the callback function.
MyClass.getAyncFunction(
"input",
function(err, data) {
this.setState({ responseData: data });
}.bind(this)
);
// Rewrite it as an arrow function so the current this is automatically bound.
MyClass.getAyncFunction("inputParams", (err, data) => {
this.setState({ responseData: data });
});
I would go with the arrow function because it's cleaner.
MyClass.getAynchFunctionexecuted?