How to Change the Color of the typography with a certain condition

Viewed 47

I am new to using Material UI with ReactJS, and trying to change the color of typography.

I don't know where to start. like I want to turn the text into the color red if the text is equal to Not Available and green if Available

<Typography variant="h6" color="Red">{item.Product_Status}</Typography>
1 Answers

You could do something like this:

color={item.Product_Status == 'available' ? return('green') : return('red') }

I dont know if the statement like that is correct but basically if you swap the double quotes for brackets you can run a js function inside the color property

Related