const ratingList = {1: "", 2: "", 3: "", 4: "", 5: ""}
type ratingType = keyof typeof ratingList
......
{Object.keys(ratingList).map((value, index) => {
if (parseInt(value) <= rating)
return <div key={index}><TiStar size={22} /></div>
else
return <div key={index}><TiStarOutline size={20} /></div>
})}
I am seeking a way to create a type that corresponds to the elements in the rating list. Essentially, I want the ratingList array [1, 2, 3, 4, 5] to be easily accessible for use elsewhere. The type should specifically represent each element of that array. Any suggestions on how to manage and update the rating list more efficiently are greatly appreciated!