Skip to content

Commit 26c975d

Browse files
committed
use flag to show custom message instead of error
1 parent 4ab3ae3 commit 26c975d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/components/CodeEditor/CodeEditor.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,16 @@ class CodeEditor extends Component {
176176
color: colors.error,
177177
padding: 10,
178178
}}>
179-
{error.message}
180-
{!window.Babel &&
181-
' (try checking your ad blocker if you have one).'}
179+
{this.state.didBabelLoad ? (
180+
error.message
181+
) : (
182+
<span>
183+
Babel could not be loaded. This can be caused by ad
184+
blockers. If you're using an ad blocker, consider adding
185+
reactjs.org to the whitelist so the live code examples
186+
will work.
187+
</span>
188+
)}
182189
</pre>
183190
</div>
184191
)}
@@ -277,6 +284,7 @@ class CodeEditor extends Component {
277284
console.error(error);
278285

279286
return {
287+
didBabelLoad: !!window.Babel,
280288
compiled: null,
281289
error,
282290
};

0 commit comments

Comments
 (0)