P
P
petrro2019-10-09 17:34:59
React
petrro, 2019-10-09 17:34:59

Why doesn't html anchor(#comm) work in JSX?

There is an object in an array where there are many such objects, using the map method, I iterate over all the objects in the array and display the contents on the page, and the comment property contains a link to the Tesla car page. At the very bottom of the page there are two comments I need so that when I click on the page link, it opens where the comments are (below). There are anchors for this: htmlbook.ru/samhtml/yakorya . And I wrote "tesla#comm". But nothing works. What did I write wrong? Help fix. Or does JSX not support anchors? Then how to implement the opening of another page in the place where I need it?

{
    image:"./images/tesla.jpg",
    name: "Tesla",
    comment: <Link to="tesla#comm"><span>Коментарии</span></Link>,
    description: "Tesla Model S — електромобиль производства американской компании Tesla"
}

And here is part of the code from the Tesla.js file:
<div className="comment"> 
             <p><a name="comm"></a></p>
              <h1 className="comment-title">Коментарі:</h1>
             <div className="comment1">
                 <h3>Петро</h3>
                 <p>Очень хорошый автомобиль!</p>
            </div> 
            <div className="comment2">
                <h3>Антон</h3>
              <p>Авто просто супер!</p>
            </div> 
        </div>
      </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vadimMalovaniy, 2019-10-09
@vadimMalovaniy

Try without tesla If not, try using the tag instead to="#comm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question