خرید بک لینک

Vote count: 0

Was working with the code below for sending a list of values to another component -

React.createElement("ul",null,
        this.state.stock.map(function (value){
          retu (React.createElement(Price, { price: value })) 
                            })
                        )

and then the values will be send to the component below -

var initialPrice = null;
var iconClass = ' ';
var counter=0;
var Price=React.createClass({
        render: function(){
            var newPrice  =  this.props.price.l_fix;
            var finalPrice = newPrice-initialPrice;

            if(finalPrice<0){
                iconClass = 'bg-danger glyphicon glyphicon-triangle-bottom text-danger';

            }
            else
                if(finalPrice>0){
                    iconClass = 'glyphicon glyphicon-triangle-top text-success bg-success';

                }

            initialPrice=newPrice;

            retu (
                React.createElement("li",null,this.props.price.t," ( ",this.props.price.e,"  ) -  "," Current Price : ",this.props.price.l_fix,"   ",  
                         React.createElement("span", { className: iconClass, "aria-hidden": "true" }),"      Date : ",this.props.price.lt)
                )
        }
    });

In the above component there is one problem. If I am sending a single value then the conditions are working fine. But, if I use a list of values then the conditions are not working correctly. Checking for last and next values for displaying the triangle arrow top and bottom. For each row what I will be rendering the expected output is different as the values what I am sending is continuously changing. How to achieve the correct way ?

asked 41 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 1 مرداد 1395 ساعت: 12:37

صفحه بندی