Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
if (this.state.error) {
/* render fallback UI */
return (
<div> Raven.lastEventId() && Raven.showReportDialog()}>
<p>We're sorry — something's gone wrong.</p>
<p>Our team has been notified, but click here fill out a report.</p>
</div>
{Toast.push('Произошла ошибка. Попробуйте перезагрузить страницу.')}
);
}
/* when there's not an error, render children untouched */
return this.props.children;
}
}
startCourseRepeating() {
const { flashcards, infoByUnits } = this.props;
const unlockedCourseFlashcards = Flashcards.getUnlockedCourseFlashcards(flashcards, infoByUnits);
const maxLastRateIndex = Flashcards.findMaxLastRateIndex(unlockedCourseFlashcards);
Toast.push('Переход к повторению по курсу');
this.setState({
onUnit: false,
onUnitRepeating: false,
sessionFlashcards: unlockedCourseFlashcards,
totalFlashcardsCount: unlockedCourseFlashcards.length,
maxLastRateIndex,
statistics: countFlashcardsStatistics(unlockedCourseFlashcards),
currentFlashcard: getNextFlashcardRandomly(unlockedCourseFlashcards, maxLastRateIndex),
});
}
componentDidCatch(error, errorInfo) {
this.setState({error});
Raven.captureException(error, {extra: errorInfo});
Toast.push('Произошла ошибка. Попробуйте перезагрузить страницу.');
}
<button>} onClick={() => Toast.push('Ссылка скопирована')}>
Скопировать ссылку</button>
componentDidMount() {
if (!this.state.hasElem) return;
this.target = this.props.targetGetter();
this.reflow();
//add throttle
this._layoutEventsToken = LayoutEvents.addListener(this.reflow);
}