Created
February 21, 2022 19:54
-
-
Save serifcolakel/7fa4c3cc1ecc5a5b226200318d9b56e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import styles from "../styles/Home.module.css"; | |
import { getProductsInCollection } from "../lib/shopify"; | |
// object destructuring to get the data from the query -> products | |
export default function Home({ products }) { | |
console.log(products); | |
return <div className={styles.container}>You are in the home Page</div>; | |
} | |
// this is the query that will be used to get the data from the shopify store | |
export async function getStaticProps() { | |
const products = await getProductsInCollection(); | |
return { | |
// this is the data that will be passed to the component as props | |
props: { products }, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment