Following this, I want to do some long process and then
set my state once the process is done.
I am doing the below routine:
constructor(props) {
super(props);
let MyParameter = this.props.navigation.state.params.Whatever;
getResults(MyParameter).then((response) => {this.setState({isLoading: false, result: response })});
this.state = {
isLoading: true,
result: null,
resultDS: new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }),
}
}
// ..
async getResults(parameter: Object)
{
let finalResult = [];
await var myfunc = function() { // Do the long process and populate finalResult}
return finalResult;
}
I followed var functionName = function() {} vs function functionName() {} and When should I store a function into a variable? and I still get error:
UnExpected token on line
await var myfunc = function() { /* ... */ }
How can I solve this issue?