All files / app/order renderOrderConfirmation.tsx

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 411x 1x   1x             1x 4x 4x 4x   4x       4x       4x 1x   1x         4x                  
import React from 'react';
import ReactDOM from 'react-dom';
 
import { configurePublicPath } from '../common/bundler';
 
import { OrderConfirmationAppProps } from './OrderConfirmationApp';
 
export type RenderOrderConfirmationOptions = OrderConfirmationAppProps;
export type RenderOrderConfirmation = typeof renderOrderConfirmation;
 
export default function renderOrderConfirmation({
    containerId,
    publicPath,
    ...props
}: RenderOrderConfirmationOptions): void {
    const configuredPublicPath = configurePublicPath(publicPath);
 
    // We want to use `require` here because we want to set up the public path
    // first before importing the app component and its dependencies.
    const { default: OrderConfirmationApp } = require('./OrderConfirmationApp');
 
    // We want to use `require` here because we only want to import the package
    // in development mode.
    if (process.env.NODE_ENV === 'development') {
        const whyDidYouRender = require('@welldone-software/why-did-you-render');
 
        whyDidYouRender(React, {
            collapseGroups: true,
        });
    }
 
    ReactDOM.render(
        <OrderConfirmationApp
            containerId={ containerId }
            publicPath={ configuredPublicPath }
            { ...props }
        />,
        document.getElementById(containerId)
    );
}