Skip to content Skip to sidebar Skip to footer

Reactjs, Json, Image Loading

I am new to reactjs -- I am looping through a json object - and I am trying to add the image path from the json object. So this is how it is currently hard coded in the component.

Solution 1:

Instead of importing image import compete json and loop through that.

importHowImage1from'../jsonpath'

Then loop through this json and get the image url from this.

classApplicationextendsReact.Component {
 constructor(){
   super();
   //loop your json here and create json
 }

  render() {
    return<div>
      // use that variable here
    </div>;
  }
}

Post a Comment for "Reactjs, Json, Image Loading"