samedi 21 octobre 2017

Condition Check in Reactjs?

Initially I have chartCategory = c3Chart in state like this

this.state{
  chartCategory = c3Chart,
  }

In condition check: previously I have like this

if(this.state.chartCategory != chartCategory){
  newChartData = chartCategory == 'highChart'? 
  ChartStore._getData('highChartData') : ChartStore._getData('chartData');
  }

Now I have extra D3 chart parameters along with Highchart and c3chart Is this the way to work

if(newChartData = chartCategory == 'highChart'){
        ChartStore._getData('highChartData');
      }else if(newChartData = chartCategory == 'c3Chart'){
       ChartStore._getData('chartData');
     }else if(newChartData = chartCategory == 'D3Chart'){
      ChartStore._getD3line();
     }

Aucun commentaire:

Enregistrer un commentaire