F
F
fronttrty2020-07-06 18:02:53
HTML
fronttrty, 2020-07-06 18:02:53

How to insert an element between 3 and 4 button?

there is a menu which I do so how to insert a picture between the 3rd and 4th element.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fronttrty, 2020-07-06
@fronttrty

import React from 'react';

import { Link } from 'react-router-dom';
import classNames from 'classnames';

function Menu({ arr, pref }) {
  const [Active, setActive] = React.useState(0);

  return (
    <div>
      {arr.map((name, index) =>
        name != 'logo' ? (
          <Link to={pref[index]}>
            <div
              className={classNames('navig', {
                active: Active == index,
                navig2: index == 4,
              })}
              onClick={() => setActive(index)}
              key={`${index}_${name}`}>
              {name}
            </div>
          </Link>
        ) : (
          <img src="../img/logo2.png" alt="" className="logo" />
        ),
      )}
    </div>
  );
}

export default Menu;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question