estk
V2EX  ›  Next.js

App Router 现在值得入手吗?

  •  
  •   estk · Apr 8, 2023 · 2764 views
    This topic created in 1129 days ago, the information mentioned may be changed or developed.
    默认 Server Component ,导致 mui 这类组件都无法使用了,虽然"use client"可以解决,但用了它反而无法用 Server Component 的特性

    此外还有 useState 等 hook 也用不了,甚至连 onClick 都不行:
    https://beta.nextjs.org/docs/rendering/server-and-client-components#when-to-use-server-vs-client-components

    虽然 App Router 有很多使用新特性,但是感觉带来很多不便
    estk
        1
    estk  
    OP
       Apr 8, 2023
    nextui 官网直接提示:Next.js 13 introduces a new app/ directory folder structure. By default it uses React Server Components. To use NextUI in those components, you need to convert them into client-side component by adding a
    'use client'; at the top of your file. NextUI only works in client-side components.[捂脸]
    https://nextui.org/docs/guide/nextui-plus-nextjs
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1002 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:17 · PVG 06:17 · LAX 15:17 · JFK 18:17
    ♥ Do have faith in what you're doing.