how to display openweather map weather icons react.js









up vote
0
down vote

favorite












im trying to display weather icons from open weather map api , but am not entirely sure how to do it , here is the documentation https://openweathermap.org/weather-conditions .. im passing in weather.icon just like its written in the docs but its not working for some reason ,can someone please tell me what i am doing wrong? thanks



app.js



 class App extends React.Component 

state =
temperature: undefined,
city: undefined,
country: undefined,
pressure: undefined,
humidity: undefined,
description: undefined,
rain:undefined,
icon:undefined,
error: undefined


handlenum1Change (evt)



let temp = (evt.target.value);







getWeather = async (e) =>
e.preventDefault();
const city = e.target.city.value;

const api_call = await fetch(`http://api.openweathermap.org/data/2.5/weather?q=$city&appid=$API_KEY&units=metric`);
const data = await api_call.json();
console.log(data)
if (city)
this.setState(
temperature: data.main.temp,
city: data.name,

icon: data.weather.icon,
rain: data.rain,
pressure: data.main.pressure,
humidity: data.main.humidity,
description: data.weather[0].description,
error: ""
);
else
this.setState(
temperature: undefined,
city: undefined,
country: undefined,
humidity: undefined,
description: undefined,
pressure:undefined,
rain : undefined,
error: "Please enter the values."
);


render()
return (
<div>
<div className="wrapper">
<div className="main">
<div className="container">
<div className="row">
<div className="col-xs-5 title-container">

</div>
<div className="col-xs-7 form-container">
<form onSubmit=this.getWeather >

<input type="text" name="city" onChange=this.handlenum1Change placeholder="City..."/>

<button>Get Weather</button>
</form>


<Weather
temperature=this.state.temperature
humidity=this.state.humidity
city=this.state.city
pressure=this.state.pressure
description=this.state.description
rain=this.state.rain
icon=this.state.icon
error=this.state.error
/>
</div>
</div>
</div>
</div>
</div>
</div>
);

;

export default App;


weather.js



import React from 'react';
import PropTypes from 'prop-types';

const Weather = props =>
<div>
<p>props.city</p>

<p> humidity props.humidity </p>

<p> props.description </p>
<p> temperature props.temperature</p>
<p> atmospheric pressure : props.pressure</p>
<p> atmospheric pressure : props.rain</p>
<img className="img-fluid" src=props.icon />
</div>





export default Weather;









share|improve this question

























    up vote
    0
    down vote

    favorite












    im trying to display weather icons from open weather map api , but am not entirely sure how to do it , here is the documentation https://openweathermap.org/weather-conditions .. im passing in weather.icon just like its written in the docs but its not working for some reason ,can someone please tell me what i am doing wrong? thanks



    app.js



     class App extends React.Component 

    state =
    temperature: undefined,
    city: undefined,
    country: undefined,
    pressure: undefined,
    humidity: undefined,
    description: undefined,
    rain:undefined,
    icon:undefined,
    error: undefined


    handlenum1Change (evt)



    let temp = (evt.target.value);







    getWeather = async (e) =>
    e.preventDefault();
    const city = e.target.city.value;

    const api_call = await fetch(`http://api.openweathermap.org/data/2.5/weather?q=$city&appid=$API_KEY&units=metric`);
    const data = await api_call.json();
    console.log(data)
    if (city)
    this.setState(
    temperature: data.main.temp,
    city: data.name,

    icon: data.weather.icon,
    rain: data.rain,
    pressure: data.main.pressure,
    humidity: data.main.humidity,
    description: data.weather[0].description,
    error: ""
    );
    else
    this.setState(
    temperature: undefined,
    city: undefined,
    country: undefined,
    humidity: undefined,
    description: undefined,
    pressure:undefined,
    rain : undefined,
    error: "Please enter the values."
    );


    render()
    return (
    <div>
    <div className="wrapper">
    <div className="main">
    <div className="container">
    <div className="row">
    <div className="col-xs-5 title-container">

    </div>
    <div className="col-xs-7 form-container">
    <form onSubmit=this.getWeather >

    <input type="text" name="city" onChange=this.handlenum1Change placeholder="City..."/>

    <button>Get Weather</button>
    </form>


    <Weather
    temperature=this.state.temperature
    humidity=this.state.humidity
    city=this.state.city
    pressure=this.state.pressure
    description=this.state.description
    rain=this.state.rain
    icon=this.state.icon
    error=this.state.error
    />
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    );

    ;

    export default App;


    weather.js



    import React from 'react';
    import PropTypes from 'prop-types';

    const Weather = props =>
    <div>
    <p>props.city</p>

    <p> humidity props.humidity </p>

    <p> props.description </p>
    <p> temperature props.temperature</p>
    <p> atmospheric pressure : props.pressure</p>
    <p> atmospheric pressure : props.rain</p>
    <img className="img-fluid" src=props.icon />
    </div>





    export default Weather;









    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      im trying to display weather icons from open weather map api , but am not entirely sure how to do it , here is the documentation https://openweathermap.org/weather-conditions .. im passing in weather.icon just like its written in the docs but its not working for some reason ,can someone please tell me what i am doing wrong? thanks



      app.js



       class App extends React.Component 

      state =
      temperature: undefined,
      city: undefined,
      country: undefined,
      pressure: undefined,
      humidity: undefined,
      description: undefined,
      rain:undefined,
      icon:undefined,
      error: undefined


      handlenum1Change (evt)



      let temp = (evt.target.value);







      getWeather = async (e) =>
      e.preventDefault();
      const city = e.target.city.value;

      const api_call = await fetch(`http://api.openweathermap.org/data/2.5/weather?q=$city&appid=$API_KEY&units=metric`);
      const data = await api_call.json();
      console.log(data)
      if (city)
      this.setState(
      temperature: data.main.temp,
      city: data.name,

      icon: data.weather.icon,
      rain: data.rain,
      pressure: data.main.pressure,
      humidity: data.main.humidity,
      description: data.weather[0].description,
      error: ""
      );
      else
      this.setState(
      temperature: undefined,
      city: undefined,
      country: undefined,
      humidity: undefined,
      description: undefined,
      pressure:undefined,
      rain : undefined,
      error: "Please enter the values."
      );


      render()
      return (
      <div>
      <div className="wrapper">
      <div className="main">
      <div className="container">
      <div className="row">
      <div className="col-xs-5 title-container">

      </div>
      <div className="col-xs-7 form-container">
      <form onSubmit=this.getWeather >

      <input type="text" name="city" onChange=this.handlenum1Change placeholder="City..."/>

      <button>Get Weather</button>
      </form>


      <Weather
      temperature=this.state.temperature
      humidity=this.state.humidity
      city=this.state.city
      pressure=this.state.pressure
      description=this.state.description
      rain=this.state.rain
      icon=this.state.icon
      error=this.state.error
      />
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      );

      ;

      export default App;


      weather.js



      import React from 'react';
      import PropTypes from 'prop-types';

      const Weather = props =>
      <div>
      <p>props.city</p>

      <p> humidity props.humidity </p>

      <p> props.description </p>
      <p> temperature props.temperature</p>
      <p> atmospheric pressure : props.pressure</p>
      <p> atmospheric pressure : props.rain</p>
      <img className="img-fluid" src=props.icon />
      </div>





      export default Weather;









      share|improve this question













      im trying to display weather icons from open weather map api , but am not entirely sure how to do it , here is the documentation https://openweathermap.org/weather-conditions .. im passing in weather.icon just like its written in the docs but its not working for some reason ,can someone please tell me what i am doing wrong? thanks



      app.js



       class App extends React.Component 

      state =
      temperature: undefined,
      city: undefined,
      country: undefined,
      pressure: undefined,
      humidity: undefined,
      description: undefined,
      rain:undefined,
      icon:undefined,
      error: undefined


      handlenum1Change (evt)



      let temp = (evt.target.value);







      getWeather = async (e) =>
      e.preventDefault();
      const city = e.target.city.value;

      const api_call = await fetch(`http://api.openweathermap.org/data/2.5/weather?q=$city&appid=$API_KEY&units=metric`);
      const data = await api_call.json();
      console.log(data)
      if (city)
      this.setState(
      temperature: data.main.temp,
      city: data.name,

      icon: data.weather.icon,
      rain: data.rain,
      pressure: data.main.pressure,
      humidity: data.main.humidity,
      description: data.weather[0].description,
      error: ""
      );
      else
      this.setState(
      temperature: undefined,
      city: undefined,
      country: undefined,
      humidity: undefined,
      description: undefined,
      pressure:undefined,
      rain : undefined,
      error: "Please enter the values."
      );


      render()
      return (
      <div>
      <div className="wrapper">
      <div className="main">
      <div className="container">
      <div className="row">
      <div className="col-xs-5 title-container">

      </div>
      <div className="col-xs-7 form-container">
      <form onSubmit=this.getWeather >

      <input type="text" name="city" onChange=this.handlenum1Change placeholder="City..."/>

      <button>Get Weather</button>
      </form>


      <Weather
      temperature=this.state.temperature
      humidity=this.state.humidity
      city=this.state.city
      pressure=this.state.pressure
      description=this.state.description
      rain=this.state.rain
      icon=this.state.icon
      error=this.state.error
      />
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      );

      ;

      export default App;


      weather.js



      import React from 'react';
      import PropTypes from 'prop-types';

      const Weather = props =>
      <div>
      <p>props.city</p>

      <p> humidity props.humidity </p>

      <p> props.description </p>
      <p> temperature props.temperature</p>
      <p> atmospheric pressure : props.pressure</p>
      <p> atmospheric pressure : props.rain</p>
      <img className="img-fluid" src=props.icon />
      </div>





      export default Weather;






      javascript reactjs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 25 at 16:57









      Logitech

      75




      75






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          In order for you to display the icon, you need to use the URL and not just icon value. Something like this



          The value returned from the API is '09d'. So you will have to append the URL with string url to have the weather api url appended with image and image extension.



          http://openweathermap.org/img/w/$props.icon.png



          enter image description here
          Few other things noticed in your code is ,



          You are setting default values as undefined, which is not correct.



          Please use proper value, something like



          state =
          temperature: '',
          city: ''



          https://codesandbox.io/s/6102m4kn3r






          share|improve this answer






















          • <img className="img-fluid" src='openweathermap.org/img/w/$props.icon'.png/> doesnt seem to work , sorry if im asking a stupid question i just started learning react
            – Logitech
            May 25 at 17:33











          • @Logitech: You have added it wrong, need to use string literals . Please check the attached image in my response for your reference. let me know if it works.
            – john sam
            May 25 at 17:38










          • <img className="img-fluid" src='openweathermap.org/img/w/$this.state.icon.png'/> I have added this line , now it just displays a broken image .. thanks for the help though.
            – Logitech
            May 25 at 17:49











          • it says $%7Bprops.icon%7D.png:1 GET openweathermap.org/img/w/$%7Bprops.icon%7D.png 404 (Not Found)
            – Logitech
            May 25 at 17:51










          • Please see the sample i have created codesandbox.io/s/6102m4kn3r
            – john sam
            May 25 at 17:56

















          up vote
          0
          down vote













          You have to make change in src attribute of <img>.
          As given in Weathermap api you have to request icon by http://openweathermap.org/img/w/10d.png.
          Replace 10d.png by props.icon+'.png'. It will work.






          share|improve this answer






















          • <img className="img-fluid" src=props.icon +'png' /> like this?
            – Logitech
            May 25 at 17:20










          • Yeah this will work instead of png put .png
            – Divyam
            May 25 at 18:11











          • tried it , its just displays broken image , thanks for the help though
            – Logitech
            May 25 at 18:16

















          up vote
          0
          down vote













          as per your code in weather.js



          <img src =`http://openweathermap.org/img/w/$this.props.icon.png` alt="wthr img" />


          it will display the weather icon...ie



           import React, Component from 'react';
          class Weather extends Component
          render()
          return (
          <div>
          <p>WeatherNow:
          <img src =`http://openweathermap.org/img/w/$this.props.icon.png`
          alt="wthr img" />
          </p>
          </div>

          );



          export default Weather;





          share|improve this answer






















          • Please add some description of your approach or how you have solved along with the code, this helps others understand answer better.
            – Akhilesh krishnan
            Nov 10 at 8:37










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50533827%2fhow-to-display-openweather-map-weather-icons-react-js%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          In order for you to display the icon, you need to use the URL and not just icon value. Something like this



          The value returned from the API is '09d'. So you will have to append the URL with string url to have the weather api url appended with image and image extension.



          http://openweathermap.org/img/w/$props.icon.png



          enter image description here
          Few other things noticed in your code is ,



          You are setting default values as undefined, which is not correct.



          Please use proper value, something like



          state =
          temperature: '',
          city: ''



          https://codesandbox.io/s/6102m4kn3r






          share|improve this answer






















          • <img className="img-fluid" src='openweathermap.org/img/w/$props.icon'.png/> doesnt seem to work , sorry if im asking a stupid question i just started learning react
            – Logitech
            May 25 at 17:33











          • @Logitech: You have added it wrong, need to use string literals . Please check the attached image in my response for your reference. let me know if it works.
            – john sam
            May 25 at 17:38










          • <img className="img-fluid" src='openweathermap.org/img/w/$this.state.icon.png'/> I have added this line , now it just displays a broken image .. thanks for the help though.
            – Logitech
            May 25 at 17:49











          • it says $%7Bprops.icon%7D.png:1 GET openweathermap.org/img/w/$%7Bprops.icon%7D.png 404 (Not Found)
            – Logitech
            May 25 at 17:51










          • Please see the sample i have created codesandbox.io/s/6102m4kn3r
            – john sam
            May 25 at 17:56














          up vote
          0
          down vote



          accepted










          In order for you to display the icon, you need to use the URL and not just icon value. Something like this



          The value returned from the API is '09d'. So you will have to append the URL with string url to have the weather api url appended with image and image extension.



          http://openweathermap.org/img/w/$props.icon.png



          enter image description here
          Few other things noticed in your code is ,



          You are setting default values as undefined, which is not correct.



          Please use proper value, something like



          state =
          temperature: '',
          city: ''



          https://codesandbox.io/s/6102m4kn3r






          share|improve this answer






















          • <img className="img-fluid" src='openweathermap.org/img/w/$props.icon'.png/> doesnt seem to work , sorry if im asking a stupid question i just started learning react
            – Logitech
            May 25 at 17:33











          • @Logitech: You have added it wrong, need to use string literals . Please check the attached image in my response for your reference. let me know if it works.
            – john sam
            May 25 at 17:38










          • <img className="img-fluid" src='openweathermap.org/img/w/$this.state.icon.png'/> I have added this line , now it just displays a broken image .. thanks for the help though.
            – Logitech
            May 25 at 17:49











          • it says $%7Bprops.icon%7D.png:1 GET openweathermap.org/img/w/$%7Bprops.icon%7D.png 404 (Not Found)
            – Logitech
            May 25 at 17:51










          • Please see the sample i have created codesandbox.io/s/6102m4kn3r
            – john sam
            May 25 at 17:56












          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          In order for you to display the icon, you need to use the URL and not just icon value. Something like this



          The value returned from the API is '09d'. So you will have to append the URL with string url to have the weather api url appended with image and image extension.



          http://openweathermap.org/img/w/$props.icon.png



          enter image description here
          Few other things noticed in your code is ,



          You are setting default values as undefined, which is not correct.



          Please use proper value, something like



          state =
          temperature: '',
          city: ''



          https://codesandbox.io/s/6102m4kn3r






          share|improve this answer














          In order for you to display the icon, you need to use the URL and not just icon value. Something like this



          The value returned from the API is '09d'. So you will have to append the URL with string url to have the weather api url appended with image and image extension.



          http://openweathermap.org/img/w/$props.icon.png



          enter image description here
          Few other things noticed in your code is ,



          You are setting default values as undefined, which is not correct.



          Please use proper value, something like



          state =
          temperature: '',
          city: ''



          https://codesandbox.io/s/6102m4kn3r







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 25 at 17:56

























          answered May 25 at 17:21









          john sam

          632516




          632516











          • <img className="img-fluid" src='openweathermap.org/img/w/$props.icon'.png/> doesnt seem to work , sorry if im asking a stupid question i just started learning react
            – Logitech
            May 25 at 17:33











          • @Logitech: You have added it wrong, need to use string literals . Please check the attached image in my response for your reference. let me know if it works.
            – john sam
            May 25 at 17:38










          • <img className="img-fluid" src='openweathermap.org/img/w/$this.state.icon.png'/> I have added this line , now it just displays a broken image .. thanks for the help though.
            – Logitech
            May 25 at 17:49











          • it says $%7Bprops.icon%7D.png:1 GET openweathermap.org/img/w/$%7Bprops.icon%7D.png 404 (Not Found)
            – Logitech
            May 25 at 17:51










          • Please see the sample i have created codesandbox.io/s/6102m4kn3r
            – john sam
            May 25 at 17:56
















          • <img className="img-fluid" src='openweathermap.org/img/w/$props.icon'.png/> doesnt seem to work , sorry if im asking a stupid question i just started learning react
            – Logitech
            May 25 at 17:33











          • @Logitech: You have added it wrong, need to use string literals . Please check the attached image in my response for your reference. let me know if it works.
            – john sam
            May 25 at 17:38










          • <img className="img-fluid" src='openweathermap.org/img/w/$this.state.icon.png'/> I have added this line , now it just displays a broken image .. thanks for the help though.
            – Logitech
            May 25 at 17:49











          • it says $%7Bprops.icon%7D.png:1 GET openweathermap.org/img/w/$%7Bprops.icon%7D.png 404 (Not Found)
            – Logitech
            May 25 at 17:51










          • Please see the sample i have created codesandbox.io/s/6102m4kn3r
            – john sam
            May 25 at 17:56















          <img className="img-fluid" src='openweathermap.org/img/w/$props.icon'.png/> doesnt seem to work , sorry if im asking a stupid question i just started learning react
          – Logitech
          May 25 at 17:33





          <img className="img-fluid" src='openweathermap.org/img/w/$props.icon'.png/> doesnt seem to work , sorry if im asking a stupid question i just started learning react
          – Logitech
          May 25 at 17:33













          @Logitech: You have added it wrong, need to use string literals . Please check the attached image in my response for your reference. let me know if it works.
          – john sam
          May 25 at 17:38




          @Logitech: You have added it wrong, need to use string literals . Please check the attached image in my response for your reference. let me know if it works.
          – john sam
          May 25 at 17:38












          <img className="img-fluid" src='openweathermap.org/img/w/$this.state.icon.png'/> I have added this line , now it just displays a broken image .. thanks for the help though.
          – Logitech
          May 25 at 17:49





          <img className="img-fluid" src='openweathermap.org/img/w/$this.state.icon.png'/> I have added this line , now it just displays a broken image .. thanks for the help though.
          – Logitech
          May 25 at 17:49













          it says $%7Bprops.icon%7D.png:1 GET openweathermap.org/img/w/$%7Bprops.icon%7D.png 404 (Not Found)
          – Logitech
          May 25 at 17:51




          it says $%7Bprops.icon%7D.png:1 GET openweathermap.org/img/w/$%7Bprops.icon%7D.png 404 (Not Found)
          – Logitech
          May 25 at 17:51












          Please see the sample i have created codesandbox.io/s/6102m4kn3r
          – john sam
          May 25 at 17:56




          Please see the sample i have created codesandbox.io/s/6102m4kn3r
          – john sam
          May 25 at 17:56












          up vote
          0
          down vote













          You have to make change in src attribute of <img>.
          As given in Weathermap api you have to request icon by http://openweathermap.org/img/w/10d.png.
          Replace 10d.png by props.icon+'.png'. It will work.






          share|improve this answer






















          • <img className="img-fluid" src=props.icon +'png' /> like this?
            – Logitech
            May 25 at 17:20










          • Yeah this will work instead of png put .png
            – Divyam
            May 25 at 18:11











          • tried it , its just displays broken image , thanks for the help though
            – Logitech
            May 25 at 18:16














          up vote
          0
          down vote













          You have to make change in src attribute of <img>.
          As given in Weathermap api you have to request icon by http://openweathermap.org/img/w/10d.png.
          Replace 10d.png by props.icon+'.png'. It will work.






          share|improve this answer






















          • <img className="img-fluid" src=props.icon +'png' /> like this?
            – Logitech
            May 25 at 17:20










          • Yeah this will work instead of png put .png
            – Divyam
            May 25 at 18:11











          • tried it , its just displays broken image , thanks for the help though
            – Logitech
            May 25 at 18:16












          up vote
          0
          down vote










          up vote
          0
          down vote









          You have to make change in src attribute of <img>.
          As given in Weathermap api you have to request icon by http://openweathermap.org/img/w/10d.png.
          Replace 10d.png by props.icon+'.png'. It will work.






          share|improve this answer














          You have to make change in src attribute of <img>.
          As given in Weathermap api you have to request icon by http://openweathermap.org/img/w/10d.png.
          Replace 10d.png by props.icon+'.png'. It will work.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 25 at 17:34









          Sphinx

          5,39521128




          5,39521128










          answered May 25 at 17:12









          Divyam

          12




          12











          • <img className="img-fluid" src=props.icon +'png' /> like this?
            – Logitech
            May 25 at 17:20










          • Yeah this will work instead of png put .png
            – Divyam
            May 25 at 18:11











          • tried it , its just displays broken image , thanks for the help though
            – Logitech
            May 25 at 18:16
















          • <img className="img-fluid" src=props.icon +'png' /> like this?
            – Logitech
            May 25 at 17:20










          • Yeah this will work instead of png put .png
            – Divyam
            May 25 at 18:11











          • tried it , its just displays broken image , thanks for the help though
            – Logitech
            May 25 at 18:16















          <img className="img-fluid" src=props.icon +'png' /> like this?
          – Logitech
          May 25 at 17:20




          <img className="img-fluid" src=props.icon +'png' /> like this?
          – Logitech
          May 25 at 17:20












          Yeah this will work instead of png put .png
          – Divyam
          May 25 at 18:11





          Yeah this will work instead of png put .png
          – Divyam
          May 25 at 18:11













          tried it , its just displays broken image , thanks for the help though
          – Logitech
          May 25 at 18:16




          tried it , its just displays broken image , thanks for the help though
          – Logitech
          May 25 at 18:16










          up vote
          0
          down vote













          as per your code in weather.js



          <img src =`http://openweathermap.org/img/w/$this.props.icon.png` alt="wthr img" />


          it will display the weather icon...ie



           import React, Component from 'react';
          class Weather extends Component
          render()
          return (
          <div>
          <p>WeatherNow:
          <img src =`http://openweathermap.org/img/w/$this.props.icon.png`
          alt="wthr img" />
          </p>
          </div>

          );



          export default Weather;





          share|improve this answer






















          • Please add some description of your approach or how you have solved along with the code, this helps others understand answer better.
            – Akhilesh krishnan
            Nov 10 at 8:37














          up vote
          0
          down vote













          as per your code in weather.js



          <img src =`http://openweathermap.org/img/w/$this.props.icon.png` alt="wthr img" />


          it will display the weather icon...ie



           import React, Component from 'react';
          class Weather extends Component
          render()
          return (
          <div>
          <p>WeatherNow:
          <img src =`http://openweathermap.org/img/w/$this.props.icon.png`
          alt="wthr img" />
          </p>
          </div>

          );



          export default Weather;





          share|improve this answer






















          • Please add some description of your approach or how you have solved along with the code, this helps others understand answer better.
            – Akhilesh krishnan
            Nov 10 at 8:37












          up vote
          0
          down vote










          up vote
          0
          down vote









          as per your code in weather.js



          <img src =`http://openweathermap.org/img/w/$this.props.icon.png` alt="wthr img" />


          it will display the weather icon...ie



           import React, Component from 'react';
          class Weather extends Component
          render()
          return (
          <div>
          <p>WeatherNow:
          <img src =`http://openweathermap.org/img/w/$this.props.icon.png`
          alt="wthr img" />
          </p>
          </div>

          );



          export default Weather;





          share|improve this answer














          as per your code in weather.js



          <img src =`http://openweathermap.org/img/w/$this.props.icon.png` alt="wthr img" />


          it will display the weather icon...ie



           import React, Component from 'react';
          class Weather extends Component
          render()
          return (
          <div>
          <p>WeatherNow:
          <img src =`http://openweathermap.org/img/w/$this.props.icon.png`
          alt="wthr img" />
          </p>
          </div>

          );



          export default Weather;






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 12 at 9:57

























          answered Nov 10 at 8:28









          Sam32

          12




          12











          • Please add some description of your approach or how you have solved along with the code, this helps others understand answer better.
            – Akhilesh krishnan
            Nov 10 at 8:37
















          • Please add some description of your approach or how you have solved along with the code, this helps others understand answer better.
            – Akhilesh krishnan
            Nov 10 at 8:37















          Please add some description of your approach or how you have solved along with the code, this helps others understand answer better.
          – Akhilesh krishnan
          Nov 10 at 8:37




          Please add some description of your approach or how you have solved along with the code, this helps others understand answer better.
          – Akhilesh krishnan
          Nov 10 at 8:37

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50533827%2fhow-to-display-openweather-map-weather-icons-react-js%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

          Syphilis

          Darth Vader #20