Next JS is an amazing JavaScript framework made on the existing react framework made by Facebook. Factors that make it amazing or the SEO features. Also Next JS as an inbuilt support for API structures which make it even more amazing when working with APIs.
It has a ton of inbuilt modules which makes development even more amazing text to image module as an instance. It automatically optimises the images as per the weight and height and other factors. The link
module enables no refresh routing which fetches the JavaScript code and renders that instead of redirecting you to another page.
It's called react on steroids because of all these inbuilt module sentence of features which come along with next.
Other frameworks like blitz.js are made on top of next.js, adding more functionalities to the framework. Next JS has a support for server side rendering which makes it incredibly faster than react and the content is available to web crawlers too.
Next v12 is now using rust compiler and is having 5x faster builds than before!
installation
To initialise a next.js application, run:
npx create-next-app@latest
# or
yarn create next-app
You can create a TypeScript project with the --ts, --typescript flag:
npx create-next-app@latest --ts
# or
yarn create next-app --typescript
file systems in next
now see the file structure carefully
The pages
directory is the entry point of the application as well as the URL structure of your website.
That is, pages/about.js
will be available at [url]/about
The public
directory will contain your assets and other images for files which are not controlled by next.
You can create as many folders and can also access them.
Like, making component folder which will contain usable components which you can reuse in different pages without writing same code every time.
wrapping up
Next js is an amazing framework for creating beautiful applications with react which perform amazingly in search results and performant on the user's side.
It's evolving into other framework too like blitz.js which are having a bit of ruby like approach.
Anyways, next is a must try if you're a react developer!
originally published here at my blog
Make sure you're subscribed to the high dose javascript newsletter
of course I can't make you, but it take me a considerable amount of time to write these..
tweet this if you like it.
thanks!
Top comments (2)
is it really that easy to use typeScript with Next?
Like is it a new feature or an old one?
yep it's easy
just add the
--ts
or--typescript
flag