I have a problem with representing of my values in my html table. I have array of values, most of them are strings, but while program works some of these become arrays. Something like I have here:
if(res.data.results[elem]['value'].toLowerCase() === nextProps.value){
res.data.results[elem]['value'] = [res.data.results[elem]['value'], 'black'];
res.data.results[elem]['another_value'] = [res.data.results[elem]['another_value'], 'black'];
}
I try to flag it with colors as you checked already. And then I print them in table, as I managed already, in this way:
<td style={{'color': result['value'][1]}}>{result.value[0]}</td>
<td style={{'color': result['another_value'][1]}}>{result.another_value[0]}</td>
When I have only string in my value I get first letter of my word/sentence/whatever. Is there another way to print whole string when value is not an array instead of making arrays from all values at the start?
isArray()developer.mozilla.org/en/docs/Web/JavaScript/Reference/… - you can use simple check likeresult['value'].isArray() ? result['value'][0] : result['value']