Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline style CSS in React is not working [duplicate]

Tags:

reactjs

I have no idea why my inline css not working here. You can see it on <div className="navbar-nav" style={background-color: red}>. Any help would be appreciate. Thanks in advance.

Full Code

import React from 'react';
import {
  BrowserRouter,
  Route,
  Link
} from 'react-router-dom';

const HeaderWrapper = () => (
    <div>
        <nav className="navbar navbar-expand-lg navbar-dark bg-dark">
          <button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
            <span className="navbar-toggler-icon"></span>
          </button>
          <div className="collapse navbar-collapse" id="navbarNavAltMarkup">
            <div className="navbar-nav" style={background-color: red}>
              <Link className="nav-item nav-link active" to="/">Home <span className="sr-only">(current)</span></Link>
              <Link className="nav-item nav-link" to="/about">About Us</Link>
              <Link className="nav-item nav-link" to="/">Whats New</Link>
              <Link className="nav-item nav-link" to="/">Designers</Link>
              <Link className="nav-item nav-link" to="/">Clothing</Link>
              <Link className="nav-item nav-link" to="/">Accessories</Link>
              <Link className="nav-item nav-link" to="/">How it Works</Link>
              <Link className="nav-item nav-link" to="/">Magazine</Link>
            </div>
          </div>
        </nav>
    </div>
)

export default HeaderWrapper
like image 283
Rido Avatar asked Nov 07 '22 17:11

Rido


1 Answers

Try:

<div className="navbar-nav" style={{ backgroundColor: 'red' }}>
like image 198
sir_thursday Avatar answered Nov 15 '22 05:11

sir_thursday