feat: gatsby strapirekin konektatzen du

This commit is contained in:
Aitor Urrutia
2022-01-14 20:18:37 +01:00
parent 851afd0c66
commit ae6e523215
10 changed files with 208 additions and 254 deletions

34
front/src/pages/index.tsx Normal file
View File

@@ -0,0 +1,34 @@
import { graphql, PageProps, useStaticQuery } from "gatsby"
import React from "react"
interface DataProps {
strapiHasiera: {
data: {
attributes: {
deskribapena: string
izenburua: string
}
}
}
}
const IndexPage: React.VFC<PageProps<DataProps>> = () => {
const {strapiHasiera} = useStaticQuery<DataProps>(graphql`
{
strapiHasiera {
data {
attributes {
deskribapena
izenburua
}
}
}
}
`)
return (
<main><h1>{strapiHasiera.data.attributes.izenburua}</h1><p>{strapiHasiera.data.attributes.deskribapena}</p></main>
)
}
export default IndexPage