Im using Last.fm API for get artist info.
I got JSON object format just like this:
object format
how can I access the "#text" with react object, because it getting error when i put # sign.
import React, { Component } from 'react';
import './App.css';
class Profile extends Component{
render(){
let artist = {name:'', stats:{listeners:''},bio:{published:''}, image:[{#text:''}]};
artist = this.props.artist !== null ? this.props.artist : artist;
return(
<div>
<img
alt="Profile"
className="profile-img"
src={artist.image[0].#text}
/>
<div>{artist.name}</div>
<div>{artist.stats.listeners}</div>
<div>{artist.bio.published}</div>
</div>
)
}
}
export default Profile;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…