|
251 | 251 | |235| [What is the behavior of uncaught errors in react 16?](#what-is-the-behavior-of-uncaught-errors-in-react-16)| |
252 | 252 | |236| [What is the proper placement for error boundaries?](#what-is-the-proper-placement-for-error-boundaries)| |
253 | 253 | |237| [What is the benefit of component stack trace from error boundary?](#what-is-the-benefit-of-component-stack-trace-from-error-boundary)| |
| 254 | +|238| [What is the required method to be defined for a class component?](#what-is-the-required-method-to-be-defined-for-a-class-component)| |
| 255 | +|239| [What are the possible return types of render method?](#what-are-the-possible-return-types-of-render-method)| |
254 | 256 |
|
255 | 257 | ## Core React |
256 | 258 |
|
|
1032 | 1034 | ReactDOM.createPortal(child, container) |
1033 | 1035 | ``` |
1034 | 1036 |
|
1035 | | - The first argument is any renderable React child, such as an element, string, or fragment. The second argument is a DOM element. |
| 1037 | + The first argument is any render-able React child, such as an element, string, or fragment. The second argument is a DOM element. |
1036 | 1038 |
|
1037 | 1039 | 49. ### What are stateless components? |
1038 | 1040 |
|
|
4032 | 4034 | 237. ### What is the benefit of component stack trace from error boundary? |
4033 | 4035 | Apart from error messages and javascript stack, React16 will display the component stack trace with file names and line numbers using error boundary concept. For example, BuggyCounter component displays the component stack trace as below, |
4034 | 4036 |
|
4035 | | -  |
| 4037 | +  |
| 4038 | +
|
| 4039 | +238. ### What is the required method to be defined for a class component? |
| 4040 | + The render() method is the only required method in a class component. i.e, All methods other than render method are optional for a class component. |
| 4041 | +239. ### What are the possible return types of render method? |
| 4042 | + Below are the list of following types used and return from render method, |
| 4043 | + 1. **React elements:** Elements that instruct React to render a DOM node. It includes html elements such as <div/> and user defined elements. |
| 4044 | + 2. **Arrays and fragments:** Return multiple elements to render as Arrays and Fragments to wrap multiple elements |
| 4045 | + 3. **Portals:** Render children into a different DOM subtree. |
| 4046 | + 4. **String and numbers:** Render both Strings and Numbers as text nodes in the DOM |
| 4047 | + 5. **Booleans or null:** Doesn't render anything but these types are used to conditionally render content. |
0 commit comments