-1
Hi Dev’s I’m new in RN, I’m trying to show the return of a json, but I can’t access by the handle on the screen, only in the console.
export default Function Functional() { const [date, setData] = useState([]); const [Refreshing, setRefreshing] = useState(true);
useEffect(() => { async Function loadInitial() {
let id = 'XXX';
var retorno = await getUser().then((value) => {
let token = JSON.parse(value);
console.log(token)
return token
}, (error) => {
console.log(error)
});
const response = await api.get('users/'+id,{ params: { jwt: retorno.jwt } })
console.log(response.data)
setData(JSON.stringify(response.data));
//setData(JSON.stringify(response.data.data)); Tentei assim tambem
}
loadInicial();
}, []);
// That way It doesn’t work
Return(
{date.name}
),
//This shows the whole Array
Return(
{date}
),
//JSON that is returning {"date": {"name": "José Paulo"}}
On the console I can print the key smoothly
I got Galera Tava Vacilando, Remove the Stringify() and it worked.
– Alan