From e9070fadab349fb74b62d74fa4a9fb623833cf6c Mon Sep 17 00:00:00 2001 From: Maciek Date: Sun, 2 Sep 2018 19:38:15 +0200 Subject: [PATCH] Refactoring : use object destructuring to retain file code style --- browser/main/Detail/SnippetNoteDetail.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index cf4df18c..9a394683 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -98,9 +98,10 @@ class SnippetNoteDetail extends React.Component { } handleGenerateToc () { - const currentMode = this.state.note.snippets[this.state.snippetIndex].mode + const { note, snippetIndex } = this.state + const currentMode = note.snippets[snippetIndex].mode if (currentMode.includes('Markdown')) { - const currentEditor = this.refs['code-' + this.state.snippetIndex].refs.code.editor + const currentEditor = this.refs[`code-${snippetIndex}`].refs.code.editor markdownToc.generateInEditor(currentEditor) } }