Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped
15 lines
526 B
Plaintext
15 lines
526 B
Plaintext
import * as React from 'react';
|
|
import { useSidecar } from './hook';
|
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
export function sidecar(importer, errorComponent) {
|
|
const ErrorCase = () => errorComponent;
|
|
return function Sidecar(props) {
|
|
const [Car, error] = useSidecar(importer, props.sideCar);
|
|
if (error && errorComponent) {
|
|
return ErrorCase;
|
|
}
|
|
// @ts-expect-error type shenanigans
|
|
return Car ? React.createElement(Car, { ...props }) : null;
|
|
};
|
|
}
|