47
loading...
This website collects cookies to deliver better user experience
Over the past couple of years, one tech stack that has consistently stood out from the crowd in developer conversations is Jamstack. In this article, we're going to go over what makes Jamstack so unique, as well as how you can get started creating your own Jamstack web app.
$ npx create next-app mynextapp
$ cd mynextapp
$ code .
node_modules
folder is where all the dependencies are stored.index.js
component, which will be for the homepage.app.js
file acts as the root component, and all of our different page components are rendered here:.gitignore
is for version control.package.json
is to keep track of our various dependencies.package.json
file, we have the dev
script, which spins up a local development server for us, to enable us to preview our app in the browser.$ npm run dev
localhost:3000
, and the following will be displayed:index.js
component. Replace all the content inside the main index.js
component is being pre-rendered before it even reaches the browser. During development, this is done via server-side rendering. The server renders the component, then sends the HTML file to the browser, which happens on each page request from the browser.about.js
file. Next.js will automatically create a route /about
, which is the name of the file, to serve up this component. The route name is tied to the file name.index.js
. Next.js doesn't create a route /index
, it just creates the route /. So all we have to do is go to the root of the domain to see the index.js
component.about.js
file, let's create a stateless functional component and export it:/about
in the browser to see the About component page:plan1.js
. In the plan1.js
file, we'll create a stateless functional component called Plan1: