April 2018
Intermediate to advanced
284 pages
6h 43m
English
This method allows us to catch the JavaScript errors in React Components. We can log those errors and display another fallback UI instead of the component tree that crashed.
Now we have a clear idea about component methods that are available in React Components.
Observe the following JavaScript code snippet:
<section><h2>My First Example</h2></section><script> var root = document.querySelector('section').createShadowRoot(); root.innerHTML = '<style>h2{ color: red; }</style>' +'<h2>Hello World!</h2>';</script>
Now, observe the following ReactJS code snippet:
var sectionStyle = { color: 'red'};var MyFirstExample = React.createClass({render: function() { return (<section><h2 style={sectionStyle}> Hello World!</h2></section> ...