Я получаю следующую ошибку при использовании react redux toastr
.Проблема была зарегистрирована Предупреждение: Компонентам функций нельзя дать ссылки.Попытки получить доступ к этой ссылке потерпят неудачу.
вот действие, которое я написал:
export const cancelToggle = (cancelled, eventId) => async (
dispatch,
getState,
{ getFirestore }
) => {
const firestore = getFirestore();
const message = cancelled
? "Are you sure you want to cancel the event?"
: "This reactivate the event - are you sure?";
try {
toastr.confirm(message, {
onOk: () =>
firestore.update(`events/${eventId}`, {
cancelled: cancelled
})
});
} catch (error) {
console.log(error);
}
};
и вот где я его использую.
<Button
onClick={() => cancelToggle(!event.cancelled, event.id)}
type="button"
color={event.cancelled ? "green" : "red"}
floated="right"
content={event.cancelled ? "Reactivate Event" : "Cancel Event"}
/>
Вот ошибка, которую я получаю:
Warning: Function components cannot be given refs. Attempts to access this ref will fail.
Check the render method of `ToastrConfirm`.
in ReduxConfirmButton (created by ToastrConfirm)
in div (created by ToastrConfirm)
in div (created by ToastrConfirm)
in div (created by ToastrConfirm)
in ToastrConfirm (created by ReduxToastr)
in span (created by ReduxToastr)
in ReduxToastr (created by Connect(ReduxToastr))
in Connect(ReduxToastr) (created by App)
in div (created by App)
in Provider (created by App)
in App (created by Connect(App))
in Connect(App)
in AppContainer