Skip to content

Extend JsonLd component to accept stringify's space property #14

@ntucakovic

Description

@ntucakovic

I have quite long JSON-LD schemas, and it would be very useful if we could support passing down space property down to JSON stringify.

Something like:

export class JsonLd<T extends Thing> extends React.Component<{
  item: WithContext<T>;
  space?: string | number;
}> {
  render() {
    return (
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{
          __html: JSON.stringify(this.props.item, safeJsonLdReplacer, this.props.space)
        }}
      />
    );
  }
}

I could do a PR with this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions