1.0.2 • Published 2 years ago

@24hr/react-structured-data v1.0.2

Weekly downloads
160
License
MIT
Repository
github
Last release
2 years ago

@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

  1. Import the module
import StructuredData from '@24hr/react-structured-data';
  1. 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>
);
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

4 years ago

1.0.0-beta.0

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago