I'm working with AsyncStorage, I need to get the value stored into "facoltà" and save it into "promessa" calling this.setState. I wrote that code:
constructor(props){
super(props)
AsyncStorage.setItem("facoltà","PROFS.json")
}
componentWillMount(){
AsyncStorage.getItem("facoltà").then((value)=>
{
console.log(value); // the console returns me PROFS.json so I thought it was working
this.setState({promessa:value})
}):
var dataObjects=require("../JsonLists/"+this.state.promessa) // but here this.state.promessa returns me null
}
the problem is that this.state.promessa returns me "null" instead of "PROFS.json" and I can't figure out how to solve it. Thanks in advance for your answers.