V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
estk
V2EX  ›  Next.js

App Router 现在值得入手吗?

  •  
  •   estk · 2023-04-08 17:30:04 +08:00 · 1871 次点击
    这是一个创建于 383 天前的主题,其中的信息可能已经有所发展或是发生改变。
    默认 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
       2023-04-08 17:46:26 +08:00
    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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3385 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:51 · PVG 19:51 · LAX 04:51 · JFK 07:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.