Skip to main content
Solved

Cannot add image to my helloworld app

  • Jun 3, 2020 5:22 AM UTC
  • 2 replies
  • 89 views

I have my logo.jpg image inside frontend folder of my helloworld app. I tried to call the image but nothing is being displayed.

import {
    initializeBlock,
    useBase,
    useRecords,
} from '@airtable/blocks/ui';
import React, { useState } from 'react';



function HelloWorldBlock() {
    // YOUR CODE GOES HERE
    return <div>Hello world  🚀<img src={'./logo.jpg'} /> <img src='./logo.jpg' /></div>;
}
initializeBlock(() => <HelloWorldBlock />);

Best answer by Leo_Lutz

It doesn’t look like their build process copies static assets across. Until they do or mention how to, you can use data URI to inject the image.

const logo = ' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAA...';

<img src={logo} />
View original
This topic has been closed for replies.

2 replies

Forum|alt.badge.img
  • New Participant
  • Answer
  • Jun 5, 2020 8:01 PM UTC

It doesn’t look like their build process copies static assets across. Until they do or mention how to, you can use data URI to inject the image.

const logo = ' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAA...';

<img src={logo} />

  • Author
  • Known Participant
  • Jun 7, 2020 8:39 PM UTC

It doesn’t look like their build process copies static assets across. Until they do or mention how to, you can use data URI to inject the image.

const logo = ' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAA...';

<img src={logo} />

Thank you so much for the hint