У меня есть этот материал-уи ListItemText:
<ListItemText primary = {<div>
<Table className = {classes.table}>
<TableRow>
<TableCell width = "40">{item.issue_state}</TableCell>
<TableCell width = "40">{item.issue_number}</TableCell>
<TableCell width = "600">{item.issue_title}</TableCell>
<TableCell width = "600">{item.issue_url}</TableCell>
</TableRow>
</Table>
</div>}/>
Вместо того, чтобы отображать URL-адрес, я хотел бы иметь что-то вроде этого:
if (item.issue_url.includes("github.com") {
item.issue_url = 'Public'
}
else if (item.issue_url.includes("github.company.com") {
item.issue_url = 'Private'
}
где TableCell отображает Public из Private, а не весь URL. Можно ли это сделать?



![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


Сделайте что-то вроде этого:
<ListItemText primary = {<div>
<Table className = {classes.table}>
<TableRow>
<TableCell width = "40">{item.issue_state}</TableCell>
<TableCell width = "40">{item.issue_number}</TableCell>
<TableCell width = "600">{item.issue_title}</TableCell>
<TableCell width = "600">{item.issue_url.includes("github.company.com") ? 'Private' : 'Public' }</TableCell>
</TableRow>
</Table>
</div>}/>
вы можете использовать, как показано ниже,
<ListItemText primary = {<div>
<Table className = {classes.table}>
<TableRow>
<TableCell width = "40">{item.issue_state}</TableCell>
<TableCell width = "40">{item.issue_number}</TableCell>
<TableCell width = "600">{item.issue_title}</TableCell>
<TableCell width = "600">{
(item.issue_url.indexOf('github.company.com') >=0)
? 'Private'
: ((item.issue._url.indexOf('github.com') >=0)
? 'Public'
: '')
}</TableCell>
</TableRow>
</Table>
</div>}/>
В противном случае рекомендуется создать производное свойство в элементе на основе issue_url.