Skip to content

Commit e9070fa

Browse files
author
Maciek
committed
Refactoring : use object destructuring to retain file code style
1 parent 1bb841d commit e9070fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

browser/main/Detail/SnippetNoteDetail.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ class SnippetNoteDetail extends React.Component {
9898
}
9999

100100
handleGenerateToc () {
101-
const currentMode = this.state.note.snippets[this.state.snippetIndex].mode
101+
const { note, snippetIndex } = this.state
102+
const currentMode = note.snippets[snippetIndex].mode
102103
if (currentMode.includes('Markdown')) {
103-
const currentEditor = this.refs['code-' + this.state.snippetIndex].refs.code.editor
104+
const currentEditor = this.refs[`code-${snippetIndex}`].refs.code.editor
104105
markdownToc.generateInEditor(currentEditor)
105106
}
106107
}

0 commit comments

Comments
 (0)