【问题标题】:Alternative for typing a nextjs page - one line键入 nextjs 页面的替代方法 - 一行
【发布时间】:2021-11-08 13:47:20
【问题描述】:

我有以下

type Props = {
  name: string
}

const Home: NextPage<Props>= ({name: string}) => {

这项工作很好,但有其他选择吗?我可以一行完成吗?

【问题讨论】:

  • 然后把整个 Props 放在&lt;&gt; 之间?

标签: reactjs typescript react-functional-component


【解决方案1】:

你可以这样做:

const Home: NextPage<{name:string}>= ({name}) => {}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-06
    • 1970-01-01
    • 2022-01-10
    • 1970-01-01
    • 2019-09-04
    • 1970-01-01
    • 2020-10-27
    • 1970-01-01
    相关资源
    最近更新 更多