gpt4 book ai didi

reactjs - 使用命名导入来响应延迟导入

转载 作者:行者123 更新时间:2023-12-03 14:26:13 25 4
gpt4 key购买 nike

如何使用惰性语法导入命名导入?

在我们可以使用之前

import { MainComponent, Component1, Component2 } from './components';

如何实现这样的事情(尽管这不起作用)?:

const { MainComponent, Component1, Component2 } = React.lazy(() => import('./components'));

最佳答案

React.lazy 不支持当前命名的导入:

This RFC has a limited surface. It's targeted at the main use case we want to start handling (default imports). There is a door open for supporting named imports in future RFCs, but it is out of scope of this one. This one is intentionally very limited. We expect to understand this problem space more within the next several months and then we can revisit that discussion with a better understanding.reactjs/rfcs#64 (comment)

关于reactjs - 使用命名导入来响应延迟导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53610028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com