Skip to content

using Preload component on its own #62

@dreyks

Description

@dreyks

I have a several-step form which sometimes includes stripe. I'm already using a Script and it works. But now I want to Preload stripe javascript on the first step if I know for sure that second step will include stripe
So I'm doing

<React.Suspense>
  <Preload href="https://js.stripe.com/v3/" rel="preload" as="script" />
</React.Suspense>

which fails, since Preload renders children which are undefined. And I have to write <Preload href="https://js.stripe.com/v3/" rel="preload" as="script">{null}</Preload>.
So maybe change this line https://github.com/palmerhq/the-platform/blob/2e24147c26124f65519a69e73d17bcc8c61c2d91/src/Preload.tsx#L34 into return children || null?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions