A React component to render structured data
npm install @24hr/react-structured-dataThis 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.
1. Import the module
``jsx`
import StructuredData from '@24hr/react-structured-data';
2. Use it
`jsx`
| Prop | Type | Default |
|---------|:-----------------:|:------------------:|
| context | string | https://schema.org |
| type | string (required) | undefined |
You can then pass it whatever structured data compatible objects as you want. These are just passed along.
A question object should have the structure:
`js`
{
question: String,
answer: String
}
Import the built-in FAQPage component
`jsx
import React from 'react';
import { FAQPage } from '@24hr/react-structured-data';
const App = () => (