Socket
Book a DemoInstallSign in
Socket

@24hr/react-structured-data

Package Overview
Dependencies
Maintainers
7
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@24hr/react-structured-data

A React component to render structured data

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
7
Created
Source

@24hr/react-structured-data

This is a simple React component to render a script tag as type application/ld+json. This can be used to create structured data for Google search according to the Schema.org definition.

How to use

  • Import the module
import StructuredData from '@24hr/react-structured-data';
  • Use it
<StructuredData type={structureDataType} {...structuredDataObject} />

Props - General

PropTypeDefault
contextstringhttps://schema.org
typestring (required)undefined

You can then pass it whatever structured data compatible objects as you want. These are just passed along.

Props - FAQPage component

PropTypeDefault
questionsarray (required)

A question object should have the structure:

{
    question: String,
    answer: String
}

Example - FAQ Page

Import the built-in FAQPage component

import React from 'react';
import { FAQPage } from '@24hr/react-structured-data';

const App = () => (
    <div>
        {/* Your content */}
        <FAQPage
            questions={[
                {
                    question: 'Test',
                    answer: 'Okey'
                }
            ]}
        />
    </div>
);

FAQs

Package last updated on 22 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts