Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

how to add html in useState

  export default function navbar() {

    const [isOpen, setIsOpen] = useState(false);

    const handleClick = () => {
      setIsOpen(!isOpen)
    }

    return (
      <nav>
        <div className="logoBtn">

          <div className="logo">
            <a href="#"><h1>Logo</h1></a>
          </div>

          <div className="btn" onClick={handleClick}>
            <div className="bar"></div>
            <div className="bar"></div>
            <div className="bar"></div>
          </div>

        </div>

        <ul className={isOpen ? 'showNav' : und}>
          <li><a href="#">Home</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Projects</a></li>
          <li><a href="#">Contact</a></li>
        </ul>

      </nav>
    );
  }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #html #useState
ADD COMMENT
Topic
Name
5+9 =