1

I am new to sitecore JSS as I followed the Official sitecore documents and created an app and then Scaffold one component to this app and also rendered Few single line and rich text Fields but i am not getting any idea how to render the images?

2

The sample apps contain a Styleguide page that has example components of how to render different field types and the options thereof, including images. For example, in React this is the sample component.

import React from 'react';
import { Image } from '@sitecore-jss/sitecore-jss-react';

/**
 * Demonstrates usage of an Image content field within JSS.
 * Image field data is uploaded into the Sitecore Media Library.
 */
const StyleguideFieldUsageImage = (props) => (
  <Image media={props.fields.sample1} />
);

export default StyleguideFieldUsageImage;
  • 1
    Thanks for help Kam, now can you please tell me how to add Image field in en.yml , where full path of my yml file is like \myapp\data\routes\en.yml??? – vinay kumar singh Feb 21 at 7:19
  • 1
    Load up the styleguide page; it tells you where to find the component and data file for each field type sample. – Kam Figy Feb 21 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.