Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The hero's journey in JavaScript frameworks

The hero's journey in JavaScript frameworks

A framework's learning progress should mirror the classical hero's journey. See how Next.js helps you to become a hero step by step.

Stefan Baumgartner

October 09, 2018
Tweet

More Decks by Stefan Baumgartner

Other Decks in Technology

Transcript

  1. !

  2. ! call to adventure crossing the threshold metamorphosis the ultimate

    boon abyss the road of trials known unknown
  3. ! call to adventure crossing the threshold metamorphosis the ultimate

    boon returning the boon abyss the road of trials known unknown
  4. ! call to adventure crossing the threshold metamorphosis the ultimate

    boon returning the boon abyss the road of trials known unknown
  5. ! call to adventure crossing the threshold metamorphosis the ultimate

    boon returning the boon abyss the road of trials
  6. ! crossing the threshold metamorphosis the ultimate boon returning the

    boon abyss the road of trials starting a new project
  7. ! metamorphosis the ultimate boon returning the boon abyss the

    road of trials starting a new project hello world
  8. ! metamorphosis the ultimate boon returning the boon abyss starting

    a new project hello world googling the error message
  9. ! metamorphosis the ultimate boon returning the boon starting a

    new project hello world googling the error message going into production
  10. ! the ultimate boon returning the boon starting a new

    project hello world googling the error message going into production understanding the technology
  11. ! returning the boon starting a new project hello world

    googling the error message going into production understanding the technology adding framework to CV
  12. ! starting a new project hello world googling the error

    message going into production understanding the technology adding framework to CV answering questions on stack overflow
  13. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure
  14. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Plot Twist!
  15. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Plot Twist!
  16. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist!
  17. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist!
  18. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist!
  19. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist! learning curve
  20. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist! learning curve
  21. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist! learning curve
  22. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist! learning curve
  23. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist! learning curve
  24. Beginning Inciting incident Second thoughts Act One Act Two Act

    Three Obstacles Obstacles Three act structure Climax Denouement End Plot Twist! learning curve
  25. Act One: Setup pages/index.js export default () => <h1>Hello World</h1>

    package.json { "name": "hello-world", "scripts": { "dev": "next", }, "dependencies": { "next": "latest", "react": "^16.0.0", "react-dom": "^16.0.0" } }
  26. Act One: Setup pages/index.js import Link from ‘next/link’ export default

    () => <> <h1>Hello World</h1> <Link href=‘/about’><a>About</a></Link> </> pages/about.js export default () => <> <h1>Hello About</h1> </>
  27. Act One: Setup Second thoughts? import Head from ‘next/head’ export

    default () => <> <Head> <title>A podcast about JavaScript</title> </Head> <h1>Hello World</h1> </>
  28. Act Two: Confrontation next.config.js const withTypescript = require('@zeit/next-typescript') const withCSS

    = require('@zeit/next-css') const withMDX = require('@zeit/next-mdx')() module.exports = withTypescript()
  29. Act Two: Confrontation next.config.js const withTypescript = require('@zeit/next-typescript') const withCSS

    = require('@zeit/next-css') const withMDX = require('@zeit/next-mdx')() module.exports = withCSS(withTypescript())
  30. Act Two: Confrontation next.config.js const withTypescript = require('@zeit/next-typescript') const withCSS

    = require('@zeit/next-css') const withMDX = require('@zeit/next-mdx')() module.exports = withMDX(withCSS(withTypescript()))
  31. Act Two: Confrontation about.js import ArticleLayout from '../components/ArticleLayout'; import About

    from '../articles/about.mdx'; import Head from 'next/head'; export default () => <ArticleLayout> <Head> <title>About ScriptCast</title> </Head> <About /> </ArticleLayout>;
  32. Act Two: Confrontation server.js const express = require('express'); const next

    = require(‘next'); const app = next(); const handle = app.getRequestHandler(); The Abyss!
  33. Act Two: Confrontation server.js const express = require('express'); const next

    = require(‘next'); const app = next(); const handle = app.getRequestHandler(); app.prepare() .then(() => { const server = express(); server.get('/api', fetchRSS()); server.get('*', (req, res) => handle(req, res)); }); The Abyss!
  34. Act Three: Resolution import App, { Container } from 'next/app'

    import React from ‘react'; export default class MyApp extends App { render () { const { Component, pageProps } = this.props; return <Container> <Component {...pageProps} /> </Container> } } _app.js
  35. Act Three: Resolution import App, { Container } from 'next/app'

    import React from ‘react'; import Player from ‘../components/Player’ export default class MyApp extends App { render () { const { Component, pageProps } = this.props; return <Container> <Component {...pageProps} /> <Player /> </Container> } } _app.js