我有一个包含组件路径的 path.json 文件
// path.json
{
"main": "./login/index.js",
"paths": [
{
"name": "login",
"path": "./login/index.js",
"image": ""
}
]
}
我想在 react native 中动态加载'./login/index.js'文件并渲染这个特定的文件
我目前的实施
const MyComponent = createLazyContainer(() => {
const componentPath = PathJson.main; // ./login/index.js
return import(`${componentPath}`); //import error here @ line 7
});
export default MyComponent;
我收到以下错误:
第 7 行的无效调用:import("" + componentPath)