当前位置:首页 > 数码 > 开倒车还是遥遥领先-Next.js支持前端SQL


admin4周前 (04-28)数码22

Recently, the Next.jsConf2023 conference showcased a groundbreaking feature called "ServerActions," which allows developers to execute SQL statements directly in their frontend code, interacting with databases seamlessly.

In the latest release, Next.js 14, ServerActions has reached its stable phase, solidifying its role as a game-changer in data handling. The team behind Next.js emphasizes that ServerActions significantly enhances the developer experience when implementing data modifications.

With ServerActions, developers can define asynchronous server functions, enabling them to perform a wide range of tasks, including revalidation of cached data, redirection to different routes, and setting and reading cookies.

In an era where the separation of frontend and backend has become prevalent,Next.js's ServerActions feature has sparked a wave of discussions, with some expressing strong disapproval.

Advantages of ServerActions

  • Streamlined Data Handling: ServerActions eliminates the need for separate APIs or complex data fetching mechanisms, simplifying data management within a single codebase.
  • Enhanced Developer Experience: By executing SQL statements directly from the frontend code, developers can quickly and efficiently perform CRUD (Create, Read, Update, Delete) operations, reducing the time and effort required for data manipulation.
  • Improved Performance: ServerActions leverages server-side rendering (SSR) to execute database queries and handle data mutations. This approach minimizes latency and improves the overall responsiveness of web applications.

Criticisms of ServerActions

  • Security Concerns: Critics argue that ServerActions may introduce security vulnerabilities, as it exposes database operations to the frontend code. Proper security measures must be implemented to mitigate potential risks.
  • Complexity: ServerActions may add unnecessary complexity to the frontend code, especially for large-scaleapplications with complex data structures.
  • Limited Use Cases: ServerActions is primarily suitable for simple data operations. For complex data manipulations or advanced database interactions, a dedicated backend or database management system may be more appropriate.


Next.js's ServerActions feature introduces a new paradigm in data management, offering both benefits and potential drawbacks. While it streamlines data handling and enhances the developer experience, it also requires careful consideration of security and complexity factors. As the technology matures and best practices emerge, ServerActions has the potential to revolutionize the development of data-intensive web applications.

What are your thoughts on ServerActions? Do you see it as a transformative technology or a potential pitfall? Share your opinions in the comments below.

Additional Resources:

  • Next.js ServerActions: The Next Step in Web Development
  • Next.js: Server-Side Rendering Using ServerActions
  • ServerActions - Discussion on GitHub






华为鸿蒙系统(HUAWEI Harmony OS),是华为公司在2019年8月9日于东莞举行的华为开发者大会(HDC.2019)上正式发布的操作系统。








学网页前台需要学SQL吗? JS呢?

怎么说呢,如果你是纯粹 的 只是做界面,只要会pw 或者说ps 做图片处理和界面设计,以及 html 和css就可以了 ,这就是纯粹的做界面,什么都不管当然一般情况 下 都不会 只有这些工作,做前端有时也要负责 数据交互,动态html所以sql 还是要学的,js不用说,必须学的,不会js的 前端开发者不算一个合格的开发者,js 浏览器端脚本语言,是动态网页的精髓,网站的很多特效和 一些 良好的体验性都是 通过js 实现的。 举个简单的例子,网站图片轮播。 这些都是需要做前端的 人做的,不可能交给做后台的人做


标签: js