Answer the question
In order to leave comments, you need to log in
I make a modal window through UIkit and when assigning an event to a link in React, it does not respond at all?
const ChooseModal = ({target, data, redirect, modal}) => {
const pageList = data.map(item => {
return (
<li key={item}>
<a
className="uk-link-muted"
href='#'
onClick={(e) => redirect(e, item)}
>{item}</a>
</li>
)
})
return (
<>
<div id={target} data-uk-modal={modal.toString()}>
<div className="uk-modal-dialog uk-modal-body">
<h2 className="uk-modal-title">Открыть</h2>
<ul className="uk-list uk-list-striped">
{pageList}
</ul>
<p className="uk-text-right">
<button
className="uk-button uk-button-default uk-modal-close"
type="button"
>Отменить</button>
</p>
</div>
</div>
</>
)
}
Answer the question
In order to leave comments, you need to log in
Because a link is a link, not a button.
To interact with elements, use buttons of the button type.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question