0

I am trying to assign image src which i get from api :

        {articles.items.map((item, key) => (
            <div class="col-lg-4">
                <div class="blog-card">
                <img src="{item.thumbnail}"/> // here
                <h2>{item.title}</h2>
          
        <p dangerouslySetInnerHTML={{__html: ' ' + item.description.slice(0,450) + '...'}}></p>
        <div>
        {item.categories.map((tag, key) => (
        <span className="tag">{tag}</span>
              ))}

But instead i am getting this in my html :

<img src="{item.thumbnail}"/> // Not really converted

How to load my dynamic image ?

1 Answer 1

3

Just remove the parentheses:

<img src={item.thumbnail} />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.