Coder Social home page Coder Social logo

alinilea / react-ssr-intro-with-nextjs-workshop Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 249 KB

An introduction to React Server Side Rendering with Next.js

Home Page: https://react-ssr-intro-with-nextjs-workshop.ileaalin.now.sh

JavaScript 100.00%

react-ssr-intro-with-nextjs-workshop's Introduction

Workshop - An introduction to React Server Side Rendering with Next.js

Setup

git clone

cd react-ssr-intro-with-nextjs-workshop

npm install

npm run dev

http://localhost:4000

Webstorm tip

in order to prevent often indexing, find .next folder in the root of the project

-> right click it -> Mark Directory as -> Excluded

Workshop steps

step1/adding-pages

  • demo: adding Home page using React functional component.
  • task: add About and Contact pages with a div element containing a paragraph.

step2/adding-styling

  • demo: adding CSS using styled-jsx (scoped, global) Styled-jsx is the built-in CSS support library.
  • task: a) add some styling as you wish. b) create in root /src/components a file named Paragraph.js. In this file create a functional component with the same name that returns a paragraph element. Add a global scope style for paragraph elements on the Home page. Add Paragraph React element on each page. What have you noticed?

step3/adding-Head-component

  • demo: adding Head component on the Home page and populate it with 2 elements: title and a meta element with the name viewport. "Head" is a built-in component for appending elements to the of the page.
  • task: add Head component to the other 2 pages using different titles.

step4/serving-static-assets

  • demo: creating a folder named "static" in the root of the project and move here the nextjs.png (from "assets" folder). displaying the file on the Home page using img element.
  • task: a) add nextjs.png as background on body element on Home page and delete the recently added img element. b) add favicon.ico on each page. c) delete assets folder.

step5/routing

  • demo: add client-side transitions between routes via a Link component. Custom routes (using props from URL). With URL object. Imperatively - you can also do client-side page transitions using the next/router.

next steps - work in progress

react-ssr-intro-with-nextjs-workshop's People

Contributors

alinilea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.