( request: Request, task: Task, keyPath: KeyNode, type: any, props: Object, ref: any, )
| 2896 | } |
| 2897 | |
| 2898 | function renderElement( |
| 2899 | request: Request, |
| 2900 | task: Task, |
| 2901 | keyPath: KeyNode, |
| 2902 | type: any, |
| 2903 | props: Object, |
| 2904 | ref: any, |
| 2905 | ): void { |
| 2906 | if (typeof type === 'function') { |
| 2907 | if (shouldConstruct(type)) { |
| 2908 | renderClassComponent(request, task, keyPath, type, props); |
| 2909 | return; |
| 2910 | } else { |
| 2911 | renderFunctionComponent(request, task, keyPath, type, props); |
| 2912 | return; |
| 2913 | } |
| 2914 | } |
| 2915 | if (typeof type === 'string') { |
| 2916 | renderHostElement(request, task, keyPath, type, props); |
| 2917 | return; |
| 2918 | } |
| 2919 | |
| 2920 | switch (type) { |
| 2921 | // LegacyHidden acts the same as a fragment. This only works because we |
| 2922 | // currently assume that every instance of LegacyHidden is accompanied by a |
| 2923 | // host component wrapper. In the hidden mode, the host component is given a |
| 2924 | // `hidden` attribute, which ensures that the initial HTML is not visible. |
| 2925 | // To support the use of LegacyHidden as a true fragment, without an extra |
| 2926 | // DOM node, we would have to hide the initial HTML in some other way. |
| 2927 | // TODO: Delete in LegacyHidden. It's an unstable API only used in the |
| 2928 | // www build. As a migration step, we could add a special prop to Offscreen |
| 2929 | // that simulates the old behavior (no hiding, no change to effects). |
| 2930 | case REACT_LEGACY_HIDDEN_TYPE: |
| 2931 | case REACT_STRICT_MODE_TYPE: |
| 2932 | case REACT_PROFILER_TYPE: |
| 2933 | case REACT_FRAGMENT_TYPE: { |
| 2934 | const prevKeyPath = task.keyPath; |
| 2935 | task.keyPath = keyPath; |
| 2936 | renderNodeDestructive(request, task, props.children, -1); |
| 2937 | task.keyPath = prevKeyPath; |
| 2938 | return; |
| 2939 | } |
| 2940 | case REACT_ACTIVITY_TYPE: { |
| 2941 | renderActivity(request, task, keyPath, props); |
| 2942 | return; |
| 2943 | } |
| 2944 | case REACT_SUSPENSE_LIST_TYPE: { |
| 2945 | renderSuspenseList(request, task, keyPath, props); |
| 2946 | return; |
| 2947 | } |
| 2948 | case REACT_VIEW_TRANSITION_TYPE: { |
| 2949 | if (enableViewTransition) { |
| 2950 | renderViewTransition(request, task, keyPath, props); |
| 2951 | return; |
| 2952 | } |
| 2953 | // Fallthrough |
| 2954 | } |
| 2955 | case REACT_SCOPE_TYPE: { |
no test coverage detected