I have a demo here
Its a super simple react app with typescript where I am simply displaying values from an enum
The enum is
export enum Colors {
colorOne = 'red',
colorTwo = 'blue',
colorThree = 'green',
colorFour = 'yellow',
colorfive = 'brown',
}
I can access the color like
<p>
{Colors.colorOne}
</p>
but if I try to access the value with a variable it doesn't work
const secondColor = 'colorTwo'
<p>
{Colors.secondColor}
</p>
This code it obviously pseudo but I'm basically trying to access the value in a enum by passing a variable
Is it possible to do this with an enum