My json returns like this:
0: {username: '[email protected]', password: '091591'}
1: {username: '[email protected]', password: 'gkfonseca7'}
2: {username: '[email protected]', password: 'oumanel'}
3: {username: '[email protected]', password: 'santossilvio'}
4: {username: '[email protected]', password: 'tamiratamira'}
5: {username: '[email protected]', password: 'gkfonseca7'}
length: 6
My code:
setPasswords(response.data) (...) {passwords.username}
CodePudding user response:
const [info, setInfo] = useState({ username: '', password: '' });
...
setInfos(data); // The data you captured
return infos.map((info, index) => <>
<span key={index}>{info.username} / {info.password}</span>
</>)
this code will help you