# All files / src/client index.tsx

0% Statements 0/17
0% Branches 0/8
0% Functions 0/5
0% Lines 0/14

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

     import type { FC } from 'react';
    import { render, Renderer } from 'react-dom';
    import { hydrate } from 'react-dom';
    import { loadableReady } from '@loadable/component';

    import { App } from '../containers/App';

    const bootstrap = (renderMethod: Renderer, Component: FC): void => {
      const root = document.getElementById('root');

      if (!root) {
        return;
      }

      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      renderMethod(<Component />, root);
    };

    if (typeof module.hot !== undefined) {
      bootstrap(render, App);
      module.hot?.accept('../containers/App', () => {
        import('../containers/App').then((m) => bootstrap(render, m.App));
      });
    } else {
      loadableReady(() => bootstrap(hydrate, App));
    }