1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow
    
  8.  */
    
  9. 
    
  10. import {REACT_PORTAL_TYPE} from 'shared/ReactSymbols';
    
  11. import {checkKeyStringCoercion} from 'shared/CheckStringCoercion';
    
  12. 
    
  13. import type {ReactNodeList, ReactPortal} from 'shared/ReactTypes';
    
  14. 
    
  15. export function createPortal(
    
  16.   children: ReactNodeList,
    
  17.   containerInfo: any,
    
  18.   // TODO: figure out the API for cross-renderer implementation.
    
  19.   implementation: any,
    
  20.   key: ?string = null,
    
  21. ): ReactPortal {
    
  22.   if (__DEV__) {
    
  23.     checkKeyStringCoercion(key);
    
  24.   }
    
  25.   return {
    
  26.     // This tag allow us to uniquely identify this as a React Portal
    
  27.     $$typeof: REACT_PORTAL_TYPE,
    
  28.     key: key == null ? null : '' + key,
    
  29.     children,
    
  30.     containerInfo,
    
  31.     implementation,
    
  32.   };
    
  33. }