Hyokune
Hyokune

Reputation: 227

React make part of prop bold inside a component

Is there a way to make part of a prob that contains strings bold? I've tried the array method but I've heard its not the correct way to do it

<ListItemText primary={thread.data.title} secondary={"Author: " + thread.data.author} />

I would like the "Author: " to be bold

Upvotes: 3

Views: 209

Answers (1)

Mos&#232; Raguzzini
Mos&#232; Raguzzini

Reputation: 15821

In react props could be anything: functions, string, objects and...JSX Try:

<ListItemText 
  primary={thread.data.title} 
  secondary={<span><b>Author</b>{thread.data.author}</span>} />

Upvotes: 5

Related Questions