U
U
uRoot2020-12-21 12:42:41
React
uRoot, 2020-12-21 12:42:41

How to add event handlers when updating a component Or why the event does not work?

There is a class component with conditional rendering:

<div id="deskresult" className={'col'}
                      {this.state.selected.length === 4 &&
                        [0, 1, 2, 3].map((item, index) =>(
                        <button
                          className='hidden-button'
                          onMouseOver={() => this.dragPoint( item)}
                        />
                      ))}
</div>

The onMouseOver event works as expected. But if you add an onMouseDown event nearby, then the onMouseDown function will not work. When these elements appear in the DOM, and if they just change the tag from button to div (in reverse order, everything is ok), then everything will work. Do not tell me what could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question