import React from 'react'

export function loadRemoteComponent<T>(
  enabled: boolean,
  remoteImport: () => Promise<{ default: T }>,
  localComponent: T
): T {
  if (enabled) {
    return React.lazy(remoteImport) as T
  }
  return localComponent
}


