From 22b72985429ee79e882497b6f300879122f36d30 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 23 Jan 2018 20:28:39 +0000 Subject: [PATCH] add comments Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/SyntaxHighlight.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/views/elements/SyntaxHighlight.js b/src/components/views/elements/SyntaxHighlight.js index a7d8f894f..82b5ae572 100644 --- a/src/components/views/elements/SyntaxHighlight.js +++ b/src/components/views/elements/SyntaxHighlight.js @@ -30,10 +30,14 @@ export default class SyntaxHighlight extends React.Component { this._ref = this._ref.bind(this); } + // componentDidUpdate used here for reusability + // componentWillReceiveProps fires too early to call highlightBlock on. componentDidUpdate() { if (this._el) highlightBlock(this._el); } + // call componentDidUpdate because _ref is fired on initial render + // which does not fire componentDidUpdate _ref(el) { this._el = el; this.componentDidUpdate();