close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2301

Table Of Contents

14.2.5.1 Rendering an Image

For this basic example, the original image is used. To use the address in an <img/> tag, it needs to be absolute. So the missing domain URL is combined with the string of the relative URI and written into the tag. In this example app the URL is already used for configuring the Apollo Client and so it is a good approach to save it in an environmental file to be accessed app wide. For example as REACT_APP_URL:

const article = data.content.article;

const serverUrl = process.env.REACT_APP_URL || "";
const imageUrl = serverUrl + article.picture.data.uri;

Example 14.12. Generating the full image URL


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.