componentWillMount () {
        var that=this;
        results = ""
        this.props.vAnalysis.forEach(function(candidate,index) {
            // If it's the first or last candidate (indices 0 or 3), the hashtag's and questions are parsed into their
            // corresponding variables
            if (index === 0) {highestAffinityHashTag = candidatesSocialMediaInfo[candidate[0]]['hashtag']; highestAffinityQuestion = candidatesSocialMediaInfo[candidate[0]]['questions']['highestAffinity'][0]}
            if (index === 3) {lowestAffinityHashTag = candidatesSocialMediaInfo[candidate[0]]['hashtag']; lowestAffinityQuestion = candidatesSocialMediaInfo[candidate[0]]['questions']['lowestAffinity'][0]} 
            results += candidate[1][1]+': '+(Math.floor((candidate[1][0]+that.props.rux)*100)/100).toString()+'%\n'
        })
        // Then the state is set for the hashtags and questions
        this.setState({
            results:title+results+'\n',
            highestAffinityHashTag: highestAffinityHashTag,
            lowestAffinityHashTag: lowestAffinityHashTag,
            highestAffinityQuestion: highestAffinityQuestion,
            lowestAffinityQuestion: lowestAffinityQuestion,
        })
    }
// Before the component render function is called, the results are computed using the parents passed down prop vAnalysis
Before the component render function is called, the results are computed using the parents passed down prop vAnalysis
Before the component render function is called the results are computed using the parents passed down prop vAnalysis
componentWillMount () {
        var that=this;
        results = ""
        this.props.vAnalysis.forEach(function(candidate,index) {
            if (index === 0) {highestAffinityHashTag = candidatesSocialMediaInfo[candidate[0]]['hashtag']; highestAffinityQuestion = candidatesSocialMediaInfo[candidate[0]]['questions']['highestAffinity'][0]}
            if (index === 3) {lowestAffinityHashTag = candidatesSocialMediaInfo[candidate[0]]['hashtag']; lowestAffinityQuestion = candidatesSocialMediaInfo[candidate[0]]['questions']['lowestAffinity'][0]} 
            results += candidate[1][1]+': '+(Math.floor((candidate[1][0]+that.props.rux)*100)/100).toString()+'%\n'
        })
        this.setState({
            results:title+results+'\n',
            highestAffinityHashTag: highestAffinityHashTag,
            lowestAffinityHashTag: lowestAffinityHashTag,
            highestAffinityQuestion: highestAffinityQuestion,
            lowestAffinityQuestion: lowestAffinityQuestion,
        })
    }
componentWillMount ( ) { var that = this ; results = "" this . props . vAnalysis . forEach ( function ( candidate , index ) { if ( index === 0 ) { highestAffinityHashTag = candidatesSocialMediaInfo [ candidate [ 0 ] ] [ 'hashtag' ] ; highestAffinityQuestion = candidatesSocialMediaInfo [ candidate [ 0 ] ] [ 'questions' ] [ 'highestAffinity' ] [ 0 ] } if ( index === 3 ) { lowestAffinityHashTag = candidatesSocialMediaInfo [ candidate [ 0 ] ] [ 'hashtag' ] ; lowestAffinityQuestion = candidatesSocialMediaInfo [ candidate [ 0 ] ] [ 'questions' ] [ 'lowestAffinity' ] [ 0 ] } results += candidate [ 1 ] [ 1 ] + ': ' + ( Math . floor ( ( candidate [ 1 ] [ 0 ] + that . props . rux ) * 100 ) / 100 ) . toString ( ) + '%\n' } ) this . setState ( { results : title + results + '\n' , highestAffinityHashTag : highestAffinityHashTag , lowestAffinityHashTag : lowestAffinityHashTag , highestAffinityQuestion : highestAffinityQuestion , lowestAffinityQuestion : lowestAffinityQuestion , } ) }
Before the component render function is called, the results are computed using the parents passed down prop vAnalysis
Before the component render function is called the results are computed using the parents passed down prop vAnalysis
// If it's the first or last candidate (indices 0 or 3), the hashtag's and questions are parsed into their // corresponding variables // Then the state is set for the hashtags and questions