google / google/react-schemaorg

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

Aperta
#1 4 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
521
Fork
20
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by reviewing the sample repository code and the documented usage of schema-dts with react-schemaorg's JsonLd component. Confirm how a typed Person value is intended to be passed, then provide a corrected, runnable example that renders without the reported syntax and console errors.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
react, typescript
Ambito
documentation, frontend
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.