Last active
October 10, 2017 17:53
-
-
Save baluragala/28cc603daaafa3bc69196d414878fdc8 to your computer and use it in GitHub Desktop.
Index component that renders React component to DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import registerServiceWorker from './registerServiceWorker'; | |
import TryCatch from './TryCatch' | |
ReactDOM.render( | |
/* | |
App component is wrapped inside TryCatch( error boundary component ). Hence any error in the App or children DOM tree, | |
error boundary component will handle it, say the DOM tree is something like App->ProductList->ProductItem->Rating, if error | |
occurs in Rating and if there are no other error boundaries in the heirarchy, error will bubble upto TryCatch and fallback UI will | |
rendered | |
*/ | |
<TryCatch> | |
<App/> | |
</TryCatch> | |
, document.getElementById('root')); | |
registerServiceWorker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment