Import 文件导入时出现错误
我在react-native中遇到了一个文件导入问题,起初我认为react-native可能有一个特殊的文件系统管理器,但是当我将我的样式分解到一个单独的application.js文件并导入时,它工作得很好,然而,当我尝试导入我的root.jsx时,它抛出了这个错误Import 文件导入时出现错误,import,react-native,Import,React Native,我在react-native中遇到了一个文件导入问题,起初我认为react-native可能有一个特殊的文件系统管理器,但是当我将我的样式分解到一个单独的application.js文件并导入时,它工作得很好,然而,当我尝试导入我的root.jsx时,它抛出了这个错误 'Unable to resolve module ./react/components/root.jsx from /Users/******/Desktop/Kaffeinate/index.ios.js: Directory
'Unable to resolve module ./react/components/root.jsx from
/Users/******/Desktop/Kaffeinate/index.ios.js: Directory
/Users/******/Desktop/Kaffeinate/react/components/root.jsx doesnt exist'
我尝试重新启动xcode和atom,但没有成功
这是我的index.ios.js
这是我的root.jsx
import React from 'react';
// import { Provider } from 'react-redux';
// import App from './app.jsx';
// import configureStore from '../store/store.js';
import {
View,
Text
} from 'react-native';
export default class Root extends React.Component {
render(){
return (
<View>
<Text>
Inside App.
</Text>
</View>
);
}
}
从“React”导入React;
//从'react redux'导入{Provider};
//从“/App.jsx”导入应用程序;
//从“../store/store.js”导入configureStore;
进口{
看法
正文
}从“反应本机”;
导出默认类根扩展React.Component{
render(){
返回(
内部应用程序。
);
}
}
您是否尝试过'/components/root.jsx'
甚至'/components/root'
?@NaderDabit是的,我尝试过将components文件夹移出react文件夹和使用或不使用.jsx的组合