Home > Back-end >  styling css by confdition from the backend
styling css by confdition from the backend

Time:06-29

dealing with reactjs, can we change css style with condition from the backend ?

to give an exemple, if the API returns true the background become blue, if returns false the background become green

CodePudding user response:

yeah, you can do like this:

<div className={`${true ? 'blue' : 'green'}`} />
  • Related