weather app

React Examples

by Sparrow Squire

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://npmcdn.com/react@latest/dist/react-with-addons.js"></script>
<script src="https://npmcdn.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>

<div id="temperatureAverage"></div>

CSS

ul {
  display: table;
  width: 100%;
  height: 200px;
  list-style: none;
  border-left: 1px solid black;
  border-bottom: 1px solid black;
  padding: 0;
  margin: 0
}

li {
  display: table-cell;
  vertical-align: bottom
}

JavaScript 1.7

var WeatherComponent = React.createClass({
    render: function() {
    	var months = [
      	{
        	month: 'Jan',
          cel: '10',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Feb',
          cel: '14',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Mar',
          cel: '14',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Apr',
          cel: '16',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'May',
          cel: '16',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Jun',
          cel: '18',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Jul',
          cel: '20',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Aug',
          cel: '22',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Sep',
          cel: '20',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Oct',
          cel: '16',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Nov',
          cel: '14',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        },
      	{
        	month: 'Dec',
          cel: '10',
          fah: '65',
          wind: '7',
          humid: '77',
          precip: '35'
        }
      ];
      
      var weatherData = months.map(function(data, index){
     ...