Jump to content

Next.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Andrewpmk (talk | contribs) at 01:25, 20 February 2022 (→‎See also: Gatsby). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Next.js
Original author(s)Guillermo Rauch[1]
Developer(s)Vercel and open-source community[2]
Initial releaseOctober 25, 2016; 7 years ago (2016-10-25)[3]
Stable release
12.0.1 / 26 October 2021; 2 years ago (2021-10-26)
Preview release
12.0.1
Repositorygithub.com/vercel/next.js
Written inJavaScript, TypeScript and Rust
PlatformWeb platform
Size17.0 MB
TypeWeb application framework
LicenseMIT License
Websitenextjs.org

Next.js is an open-source development framework built on top of Node.js enabling React based web applications functionalities such as server-side rendering and generating static websites. React documentation mentions Next.js among "Recommended Toolchains" advising it to developers as a solution when "Building a server-rendered website with Node.js".[4] Traditional React apps render all their content in the client-side browser, Next.js is used to extend this functionality to include applications rendered on the server side.

The copyright and trademarks for Next.js are owned by company Vercel (previously named ZEIT), which also maintains and leads its open-source development.[5]

Background

Next.js is a React framework that enables several extra features, including server-side rendering and generating static websites.[6] React is a JavaScript library that is traditionally used to build web applications rendered in the client's browser with JavaScript.[7] Developers recognize several problems with this strategy however, such as not catering to users who do not have access to JavaScript or have disabled it, potential security issues, significantly extended page loading times, and it can harm the site's overall search engine optimization.[7] Frameworks such as Next.js sidestep these problems by allowing some or all of the website to be rendered on the server-side before being sent to the client.[7][8] Next.js is one of the most popular components available in React.[9] It is one of several recommended "toolchains" available when starting a new app, all of which provide a layer of abstraction to aid in common tasks.[10] Next.js requires Node.js and can be initialized using Node Package Manager.

Google has donated to the Next.js project, contributing 43 pull requests in 2019, where they helped in pruning unused JavaScript, reducing overhead time, and adding improved metrics.[11] As of March 2020, the framework is used by many large websites, including Netflix, GitHub, Uber, Ticketmaster, and Starbucks.[7] In early 2020, it was announced that Vercel had secured twenty-one million dollars in Series A funding to support improvements to the software.[1] The framework's original author, Guillermo Rauch, is currently the CEO of Vercel, and the project's lead developer is Tim Neutkens.[12]

Development history

Next.js was first released as an open-source project on GitHub on October 25, 2016; 7 years ago (2016-10-25).[3] It was originally developed based on six principles: out-of-the box functionality requiring no setup, JavaScript everywhere, all functions are written in JavaScript, automatic code-splitting and server-rendering, configurable data-fetching, anticipating requests, and simplifying deployment.[13] Next.js 2.0 was announced in March 2017 including several improvements that made it easier to work with small websites. It also increased the build efficiency and improved the scalability of the hot-module replacement feature.[14] Version 7.0 was released in September 2018 with improved error handling and support for React's context API for improved dynamic route handling. This was also the first version to upgrade to webpack 4.[15] Version 8.0 was released in February 2019 and was the first version to offer serverless deployment of applications, in which the code is split up into lambda functions that are run on demand. The version also reduced the time and resources required for static exports and improved prefetch performance.[16] Version 9.3, announced in March 2020, included various optimizations and global Sass and CSS module support.[17] On July 27, 2020 Next.js version 9.5 was announced, adding new capabilities including incremental static regeneration, rewrites, and redirect support.[18] On June 15, 2021 Next.js version 11 was released, introducing among others: Webpack 5 support, preview of real-time collaborative coding functionality "Next.js Live", and experimental function of automatic conversion from Create React App to Next.js compatible form "Create React App Migration".[19] On October 26, 2021, Next.js 12 was released, adding a Rust compiler, making the compilation faster, AVIF support, Edge Functions & Middleware, and Native ESM & URL Imports.[20]

Styling and features

The Next.js framework utilizes Jamstack architecture, which distinguishes between front-end and back-end and allows for efficient front-end development that is independent of any back-end APIs.[1] The framework supports common CSS as well as precompiled Scss and Sass, CSS-in-JS, and styled JSX.[10] In addition, it is built with TypeScript support and smart bundling.[21] The open source transpiler Babel is used to transform and compile code into JavaScript usable by a browser. Webpack, another open-source tool, is used to bundle the modules afterwards. All of these tools are used with npm in a terminal.[11]

The main feature of Next.js is its use of server-side rendering to reduce the burden on web browsers and provide enhanced security[citation needed]. This can be done for any part of the application or the entire project, allowing for content-rich pages to be singled out for server-side rendering.[7] It can also be done only for first time visitors, to reduce the burden on web browsers that have yet to download any of the site's assets.[8] The "hot reloading" feature detects changes as they are made and re-renders the appropriate pages so the server avoids the need to be restarted. This allows changes made to the application code to be immediately reflected in the web browser, though some browsers will require the page to be refreshed.[7] The software uses page-based routing for developer convenience and includes support for dynamic routing. Other features include hot-module replacement so that modules can be replaced live, automatic code splitting, which only includes code necessary to load the page, and page prefetching to reduce load time.[7]

Next.js also supports incremental static regeneration (ISR) and static static site generation (SSG) - A complied version of the website is usually built during build time and saved as a .next folder. When a user makes a request, the pre-built version which are static HTML pages are cached and sent to them. This makes the load time very fast, but it's not suitable for every website because for interactive sites that change often and utilize a lot of user input will not be suitable.

See also

References

  1. ^ a b c April 21, Matt Asay in Developer on; 2020; Pst, 9:51 Am. "How Next.js aims to simplify front-end development". TechRepublic. Retrieved 2020-10-20. {{cite web}}: |last2= has numeric name (help)CS1 maint: numeric names: authors list (link)
  2. ^ "vercel/next.js". GitHub. Archived from the original on 2019-03-16. Retrieved 2019-03-17.
  3. ^ a b "Next.js First Release". GitHub. 2019-03-14. Archived from the original on 2020-10-10. Retrieved 2019-03-17.
  4. ^ "Recommended Toolchains". React documentation. Retrieved 10 July 2021.
  5. ^ "Develop. Preview. Ship. For the best frontend teams – Vercel". vercel.com. Archived from the original on 2021-10-06. Retrieved 2020-09-22.
  6. ^ "Differences Between Static Generated Sites And Server-Side Rendered Apps". Smashing Magazine. 2020-07-02. Retrieved 2020-10-19.
  7. ^ a b c d e f g Thakkar, Mohit (2020), Thakkar, Mohit (ed.), "Next.js", Building React Apps with Server-Side Rendering: Use React, Redux, and Next to Build Full Server-Side Rendering Applications, Berkeley, CA: Apress, pp. 93–137, doi:10.1007/978-1-4842-5869-9_3, ISBN 978-1-4842-5869-9, retrieved 2020-10-20
  8. ^ a b Thakkar, Mohit (2020), Thakkar, Mohit (ed.), "Adding Server-Side Rendering to Your React Application", Building React Apps with Server-Side Rendering: Use React, Redux, and Next to Build Full Server-Side Rendering Applications, Berkeley, CA: Apress, pp. 139–152, doi:10.1007/978-1-4842-5869-9_4, ISBN 978-1-4842-5869-9, retrieved 2020-10-20
  9. ^ December 2, Matt Asay in Developer on; 2019; Pst, 11:58 Am. "Why front-end development may be the new frontier". TechRepublic. Retrieved 2020-10-20. {{cite web}}: |last2= has numeric name (help)CS1 maint: numeric names: authors list (link)
  10. ^ a b "Comparing Styling Methods In Next.js". Smashing Magazine. 2020-09-17. Retrieved 2020-10-20.
  11. ^ a b January 31, Matt Asay in Developer on; 2020; Pst, 6:33 Pm. "An insider's look at Google's web framework contributions to Next.js and more". TechRepublic. Retrieved 2020-10-19. {{cite web}}: |last2= has numeric name (help)CS1 maint: numeric names: authors list (link)
  12. ^ "Static site generation with single page app functionality? That's what's coming Next(.js)". Stack Overflow Blog. 2020-10-07. Retrieved 2020-10-20.
  13. ^ Krill, Paul (2016-10-31). "Next step after Node.js: Framework for 'universal' JavaScript apps". InfoWorld. Retrieved 2020-10-20.
  14. ^ Krill, Paul (2017-03-28). "Next.js 2.0 plays better with React and JavaScript". InfoWorld. Retrieved 2020-10-20.
  15. ^ Krill, Paul (2018-09-21). "Next.js 7 framework compiles faster, supports WebAssembly". InfoWorld. Retrieved 2020-10-20.
  16. ^ Krill, Paul (2019-02-14). "Next.js 8 now supports serverless apps". InfoWorld. Retrieved 2020-10-20.
  17. ^ Krill, Paul (2020-03-12). "Next.js upgrade emphasizes static site generation". InfoWorld. Retrieved 2020-10-20.
  18. ^ Krill, Paul (July 27, 2020). "Next.js adds incremental static pages regeneration". InfoWorld. Archived from the original on October 2, 2020. Retrieved September 22, 2020.
  19. ^ "Next.js 11". Retrieved 2021-07-10.
  20. ^ "Next.js 12". nextjs.org. Retrieved 2021-10-27.
  21. ^ Krill, Paul (February 14, 2019). "Next.js 8 now supports serverless apps". InfoWorld. Archived from the original on October 2, 2020. Retrieved September 22, 2020.