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

Get Started With {Next.js,Nuxt.js,Sapper} - VueJS Indonesia x ReactID x SvelteID

Odi
August 30, 2020

Get Started With {Next.js,Nuxt.js,Sapper} - VueJS Indonesia x ReactID x SvelteID

Odi

August 30, 2020
Tweet

More Decks by Odi

Other Decks in Programming

Transcript

  1. How to Get Started with Next.js - Nuxt.js - Sapper?

    Vue.js ID x React ID x Svelte ID
  2. Penyangkalan (Disclaimer) Acara kali ini bukan bermaksud membanding-bandingkan masing-masing kerangka

    kerja satu sama lain, tetapi lebih ke arah pengenalan singkat uniknya fitur masing-masing kerangka kerja.
  3. - Dibuat oleh Vercel (sebelumnya ZEIT), founded by Guillermo Rauch

    (Socket.io, Slackin, MooTools etc) - JAMStack? - Dimulai dari kerangka kerja React untuk SSR - Berevolusi mendapatkan kemampuan static optimization ketika tidak butuh data fetching di halaman-halaman tertentu (exported as html instead) - Berevolusi lagi mendapatkan kemampuan SSG (server side generation), merender halaman-halaman sesuai konfigurasi pada build time. - Pages, halaman (komponen React di direktori khusus), sebagai first class citizen
  4. • Mempermudah struktur sebuah Vue App • SSR / SSG

    • Routing • Struktur Direktori • SEO
  5. • No config by default • HTML statis untuk setiap

    halaman di `pages` directory • Juga untuk route dinamis, akan memanggil `getStaticPaths` dan generate halaman dari hasilnya. • Untuk keadaan lebih kompleks bisa memberikan pengaturan `exportPathMap` di `next.config.js` • Hasil ada di direktori `out`
  6. - Awal mula Next.js “The React Framework for SSR” -

    Dipakai untuk website-website yang sangat dinamis (User generated content, e-commerce, dll)
  7. • `npm init next-app` • `yarn create next-app` • Berdasarkan

    library “create-next-app” • Bisa pilih example/kode boilerplate untuk memulai lebih cepat
  8. • `npm init next-app` • `yarn create next-app` • Berdasarkan

    library “create-next-app” • Bisa pilih example/kode boilerplate untuk memulai lebih cepat
  9. • `npm init next-app` • `yarn create next-app` • Berdasarkan

    library “create-next-app” • Bisa pilih example/kode boilerplate untuk memulai lebih cepat
  10. • `npm init next-app` • `yarn create next-app` • Berdasarkan

    library “create-next-app” • Bisa pilih example/kode boilerplate untuk memulai lebih cepat
  11. • `npm init next-app` • `yarn create next-app` • Berdasarkan

    library “create-next-app” • Bisa pilih example/kode boilerplate untuk memulai lebih cepat
  12. • `npm init next-app` • `yarn create next-app` • Berdasarkan

    library “create-next-app” • Bisa pilih example/kode boilerplate untuk memulai lebih cepat Masih banyak lagi, capek screenshot LOL
  13. Direktori khusus • `pages` atau `src/pages`: untuk top level react

    components (Pages), setiap komponen React yang ada di sini akan punya 1 halaman masing masing (ga butuh konfigurasi routing khusus) • `public`: untuk file statik. Contoh: `public/favicon.ico` bakal bisa diakses di `${URL}/favicon.ico` • `pages/api` atau `src/pages/api`: serverless functions! Langsung jadi API endpoints.
  14. n/a

  15. • It’s just React! • Import whatever library you like

    from npm, use it in the Page • Use it in the Components • Custom CSS? Slap dat `style` tag • Custom Font? Put it in`public` directory, slap some @font-face declaration • Custom JS? Analytics? Customize the base _document.js component GO WILD
  16. • It’s just React! • Import whatever library you like

    from npm, use it in the Page • Use it in the Components • Custom CSS? Slap dat `style` tag • Custom Font? Put it in`public` directory, slap some @font-face declaration • Custom JS? Analytics? Customize the base _document.js component GO WILD - see examples for more
  17. • Sama seperti Svelte pada umumnya • import pustaka apapun

    yang kamu suka dari npm • Kustom CSS? Gunakan tag link pada svelte:head • Kustom Font? Masukan pada folder static dan deklarasikan dengan @font-face • Menambahkan analitik? Masukan di pada template.html
  18. • Sama seperti Svelte pada umumnya • import pustaka apapun

    yang kamu suka dari npm • Kustom CSS? Gunakan tag link pada svelte:head • Kustom Font? Masukan pada folder static dan deklarasikan dengan @font-face • Menambahkan analitik? Masukan di pada template.html ReferenceError: window is not defined
  19. • Ada beberapa built in styling methods di Next •

    `styled-jsx` (gak kita bahas) • *global stylesheet* • CSS modules (scoped)
  20. Although it’s the easiest way to do it Takes less

    than a minute! You will get your own (sub)domain, https, autoscaling, all provisioned for you. Go check them out!
  21. • Jumlah frontend developer di Indonesia yang semakin banyak •

    Komunitas yang tersegregasi dengan sekat grup-grup Telegram • Telegram kurang scalable untuk menampung puluhan ribu anggota dengan tetap mempertahankan konteks/alur diskusi • Fitur-fitur di Discord cukup lengkap untuk mengelola komunitas berskala besar, termasuk di antaranya adalah Reactiflux, the world's largest React.js chat server. Mengapa?
  22. Ini bukan sebatas gagasan segelintir orang, tapi agregasi atas berbagai

    upaya serupa yang masih tercerai-berai: • Fatih Kalifa sempat menginisiasi meetup Frontend ID di tahun 2015 • Resi Respati sudah menyiapkan Discord Server dengan berbagai fitur moderasinya sejak tiga bulan yang lalu • Jefry Dewangga menginisiasi meetup antar-framework ini • dan beberapa penggerak komunitas lainnya yang juga merasakan pentingnya sarana pemersatu frontend developer se-Indonesia Siapa saja yang terlibat?