Answer the question
In order to leave comments, you need to log in
Why is the variable not inserted in JSX?
An image should be inserted into the src tag, but unknown is inserted
Answer the question
In order to leave comments, you need to log in
Inside the component:
this.state = {
beerImage: null,
}
componentDidMount() {
promise.then(beer => this.setState({beerImage: beer.image}))
}
const {beerImage} = this.state;
<img src={beerImage} />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question