mardi 7 mars 2017

React JS (if statements)

i am new to React JS.. and would like some help with if statements relating to it as i have been told its completely different to java. So my question is how would you write an if statement in react. Say I want to print the text "ground is muddy" when there is heavy rain(where percipitation is over50%). else if(percipitation less than 50 and more than 20)-->"ground partially muddy").else-->ground is not muddy. Will the if statements be inserted in the render() or return?

this.setState({ 
// set states for fields so they could be rendered later on

        locate: location,
        temp: temp_c,
        cond : conditions,//rain status
        fog : fogg,
        vis : visib,
        wind : wind_speed,

The code should also find the rain status via an API.

Thank you very much guys

Aucun commentaire:

Enregistrer un commentaire