diff --git a/src/components/App.js b/src/components/App.js index 73720fee..efb8f7db 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -10,6 +10,7 @@ import { initialValues } from '../constants'; import { useAppContext } from './Context'; import HtmlPreview from './HtmlPreview'; import state from '../lib/state'; +import ErrorBox from './ErrorBox'; const savedState = state.load(); @@ -60,11 +61,17 @@ function App() { />
> - {parsed.text || parsed.error || 'undefined'} + {parsed.error + ? `Error: ${parsed.error}` + : parsed.text || 'undefined'}
- + {parsed.error ? ( + + ) : ( + + )} diff --git a/src/components/ErrorBox.js b/src/components/ErrorBox.js new file mode 100644 index 00000000..71d6c02c --- /dev/null +++ b/src/components/ErrorBox.js @@ -0,0 +1,13 @@ +import React from 'react'; + +function ErrorBox({ caption, body }) { + return ( +
+
Error: {caption}
+ +
{body}
+
+ ); +} + +export default ErrorBox;