Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-schemaorg

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-schemaorg - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

dist/src/index.d.ts

35

package.json
{
"name": "react-schemaorg",
"version": "1.0.2",
"version": "1.1.0",
"displayName": "React: Schema.org",

@@ -12,12 +12,18 @@ "description": "Typed Schema.org JSON-LD in React",

],
"files": [
"dist/**/*"
],
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/src/index.d.ts",
"main": "./dist/src/index.js",
"devDependencies": {
"@babel/plugin-transform-react-jsx": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"@babel/preset-typescript": "^7.10.1",
"@types/jest": "^26.0.0",
"@types/react": "^16.7.22",
"react": "^15.4.1",
"@types/react-test-renderer": "^16.9.2",
"coveralls": "^3.1.0",
"jest": "^26.0.1",
"prettier": "^2.0.5",
"react": "^16.13.1",
"react-test-renderer": "^16.13.1",
"schema-dts": ">=0.4.0",
"typescript": "^3.8.3"
"typescript": "^3.9.5"
},

@@ -38,4 +44,15 @@ "dependencies": {},

"Linked Data",
"linked-data"
"linked-data",
"react-helmet",
"helmet",
"script"
],
"scripts": {
"lint": "prettier --check src/",
"fix": "prettier --write src/",
"test": "npm run lint && tsc --build type-test/ && jest",
"build": "tsc --build .",
"prepare": "npm run build",
"coverage_on_travis": "cat ./coverage/lcov.info | coveralls"
},
"homepage": "https://github.com/google/react-schemaorg#readme",

@@ -42,0 +59,0 @@ "bugs": "https://github.com/google/react-schemaorg/issues",

@@ -1,8 +0,10 @@

[![react-schemaorg npm version](https://badge.fury.io/js/react-schemaorg.svg)](https://www.npmjs.com/package/react-schemaorg)
[![react-schemaorg npm version](https://badge.fury.io/js/react-schemaorg.svg)](https://www.npmjs.com/package/react-schemaorg) [![Build Status](https://travis-ci.org/google/react-schemaorg.svg?branch=master)](https://travis-ci.org/google/react-schemaorg) [![Coverage Status](https://coveralls.io/repos/github/google/react-schemaorg/badge.svg?branch=master)](https://coveralls.io/github/google/react-schemaorg?branch=master)
# react-schemaorg
Easily insert valid Schema.org JSON-LD using the custom `<JsonLd>` react
component.
Easily insert valid Schema.org JSON-LD in your React apps.
This library provides `<JsonLd>` for plain React apps, and `helmetJsonLdProp()`
for use with [`<Helmet>`](https://github.com/nfl/react-helmet).
Uses [schema-dts](https://github.com/google/schema-dts) for Schema.org

@@ -24,5 +26,7 @@ TypeScript definitions.

Then, to insert a simple JSON-LD snippet:
### Plain React Usage
```ts
To insert a simple JSON-LD snippet:
```tsx
import { Person } from "schema-dts";

@@ -32,4 +36,33 @@ import { JsonLd } from "react-schemaorg";

export function GraceHopper() {
return <JsonLd<Person>
item={{
return (
<JsonLd<Person>
item={{
"@context": "https://schema.org",
"@type": "Person",
name: "Grace Hopper",
alternateName: "Grace Brewster Murray Hopper",
alumniOf: {
"@type": "CollegeOrUniversity",
name: ["Yale University", "Vassar College"],
},
knowsAbout: ["Compilers", "Computer Science"],
}}
/>
);
}
```
### [React Helmet](https://github.com/nfl/react-helmet) Usage
To set JSON-LD in React Helmet, you need to pass it to the `script={[...]}` prop
array in the `Helmet` component:
```tsx
import { Person } from "schema-dts";
import { helmetJsonLdProp } from "react-schemaorg";
import { Helmet } from "react-helmet";
<Helmet
script={[
helmetJsonLdProp<Person>({
"@context": "https://schema.org",

@@ -41,7 +74,8 @@ "@type": "Person",

"@type": "CollegeOrUniversity",
name: ["Yale University", "Vassar College"]
name: ["Yale University", "Vassar College"],
},
knowsAbout: ["Compilers", "Computer Science"]
}}/>;
}
knowsAbout: ["Compilers", "Computer Science"],
}),
]}
/>;
```

@@ -48,0 +82,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc