【问题标题】:What does "export { <function> }" mean in a React module?\"export { <function> }\" 在 React 模块中是什么意思?
【发布时间】:2023-01-23 09:50:43
【问题描述】:

我最近看到一个人导出了这样一个模块:

const supabase = createClient(url, key);
export { supabase };

我见过以这种方式进行导出,这是有道理的:

export default supabase; // to make supabase the default export, which we'd import without curly brackets

export supabase // to make supabase an export, which would require curly brackets on import

但什么是 export { supabase }

【问题讨论】:

    标签: node.js reactjs supabase


    【解决方案1】:

    像这样导入为对象:

    import { supabase } from ...yourLibrary
    

    【讨论】:

      猜你喜欢
      • 2019-12-26
      • 1970-01-01
      • 2020-04-29
      • 2017-02-27
      • 2011-02-25
      • 2013-10-20
      • 1970-01-01
      • 2012-07-04
      • 2016-02-14
      相关资源
      最近更新 更多