Dynamically change Next.js style type for element

  javascript, next.js, typescript

I am attempting to change the color of an element based off of the result from a function

  //Example function 
  if ("123".includes("5")) {
    color = "boldOrange"
  } else {
      let color = "boldGreen"
  }

In my CSS, I have two classes, boldGreen and boldOrange. This is the tag:

 <b className={styles.color}>(-3.44)</b>

How would I update the styling class based off of the function? I am using Next.js as my framework.

Source: Ask Javascript Questions

LEAVE A COMMENT