This file contains hidden or 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
export async function getStaticProps(context) { | |
// some back end code here | |
return { | |
props: {}, // will be passed to the page component as props | |
} | |
} |
This file contains hidden or 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
// pages/products/[id].js | |
import { getProduct, getProductsIds } from '../../actions' | |
import Link from 'next/link' | |
export default function ProductDetail({product}){ | |
return ( | |
<div className="container"> | |
<div className="row"> |
This file contains hidden or 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/globals.css' | |
import Layout from '../components/layout' | |
function MyApp({ Component, pageProps }) { | |
return ( | |
<div> | |
<Layout> | |
{/* <Component /> represents each route's content */} | |
<Component {...pageProps} /> | |
</Layout> |
This file contains hidden or 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 { Route, Switch} from 'react-router-dom'; | |
import './App.css'; | |
import Home from './Home'; | |
import About from './About'; | |
import Contact from './Contact'; | |
import Layout from './Layout'; | |
function App() { | |
return ( |
NewerOlder