Gcobani Mkontwana

Gcobani Mkontwana

  • 565
  • 1.9k
  • 406.8k

Image not loading when using local path in React App

Jun 5 2022 6:12 AM

Hi Team

 

I want to display an image and im using react, but i cant seem to achieve and need help to display an image according to style sheet used and with react.

 

//Drone.js

import React, { Component } from 'react';

 

class ImageComponent extends Component {

    constructor(props) {

        super(props);

    }

    render() {

        return (

            <div>

                <img src={this.props.url} alt="display image" />

               

            </div>

        );

    }

}

export default ImageComponent;

//App.js import React from "react"; import './App.css'; import './index.css'; import ImageComponent from "./components/images/Drone"; class App extends React.Component { // Constructor constructor(props) { super(props); function App() { return(

 

); } } } export default App;

 

//App.css

.image {

  width: 416px;

  height: 416px;

}


Answers (1)