google / google/react-schemaorg

Structure is not well defined, how proper use it with schema-dts

Open
#1 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
521
Forks
20
PR merge metrics
No merged PRs in 30d

Description

Hello, im using `"react": "^16.6.0"`

The sample repo code is this one (which have a syntax error):
```jsx
import { Person } from "schema-dts";
import { JsonLd } from "react-schemaorg";

export function GraceHopper() {
return
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"]
}}/>;
}
```

If i use code like this all works fine
```jsx
import { JsonLd } from "react-schemaorg";

export function personJsonLd() {
const sampleData = {
"@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"]
};


return ;
}
```

But as you can see in the previous code i haven't used the DTS, how can i use the schema-dts library, i didn't figure it out 😞
i have try the return like:
```jsx
return (



);
```

But got a bunch of console error, some light/improved example would be much appreciated 🙏🏽
Thanks in advance

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.