Last active
July 25, 2017 10:15
-
-
Save jthegedus/a2492375f09f000c5e9244286186f12f to your computer and use it in GitHub Desktop.
Cloud Functions for Firebase - NextJS example
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
# src/app/.gitignore | |
.next |
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
// src/app/components/App.js | |
import Header from "./Header" | |
const App = ({ children }) => | |
<main> | |
<Header /> | |
{children} | |
</main> | |
export default App |
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
// src/app/components/Header.js | |
import Link from "next/link" | |
export default ({ pathname }) => | |
<header> | |
<Link href="/"> | |
<a className={pathname === "/" && "is-active"}>Home</a> | |
</Link>{" "} | |
<Link href="/about"> | |
<a className={pathname === "/about" && "is-active"}>About</a> | |
</Link> | |
</header> |
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
// src/app/next.config.js | |
module.exports = { | |
distDir: "../functions/next" | |
} |
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
// src/app/pages/about.js | |
import App from "../components/App" | |
export default () => | |
<App> | |
<p>About Page</p> | |
</App> |
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
// src/app/pages/index.js | |
import App from "../components/App" | |
export default () => | |
<App> | |
<p>Index Page</p> | |
</App> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment