jrz
jrz

Reputation: 1387

Mark a line with a color in React js

I would like to mark a certain line in my React component in green.

After searching for a way to do that, this is what I wrote:

     var transferDateElemet =  <tr>
                  <td>Date of transfer to organization </td>
                  <td style={{color: green,background: '#00CC00'}}>
                             {transferDate.getUTCDate() + "/" + (transferDate.getUTCMonth() +1 ) + "/" + transferDate.getUTCFullYear()}{transferDateExpected}
                  </td>
              </tr>;

Of course, it is written inside render().

I would like to get a suggestion of how to make it work. Also, if I did not supply enough details please let me know.

*This is the error I get:

Failed to compile.

EBUSY: resource busy or locked, unlink 'C:\Users\***\***\***\***\***\***\static\media\logo.ee7cd8ed.svg'


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Upvotes: 0

Views: 808

Answers (2)

Root
Root

Reputation: 2361

There is no need to add div in tr element.Try this:

<td style={{color: green,background: '#00CC00'}}>
{transferDate.getUTCDate() + "/" + (transferDate.getUTCMonth() +1 ) + "/" + transferDate.getUTCFullYear()}{transferDateExpected}

Edit: For your problem, there are many reasons for this, so here are some options for you to try.

  1. run npm cache clean and npm install
  2. close editor software and open it again
  3. if you are using windows, close node.js serve in back terminal and close the window defender

Upvotes: 1

Abhishek Mehandiratta
Abhishek Mehandiratta

Reputation: 314

The color property makes the text color green. Is the text not changing to green? If not try using hex code and see if it works

Upvotes: 0

Related Questions