2017-10-12 68 views
0

我怎樣才能做一個反應類,管理我所有的進口路徑? likeReact Class來管理進口

import Paths from './Paths' 
import LoginScreen from Paths.LoginScreen 

因爲Visual Studio Code沒有重構功能。

的package.json

{ 
    "name": "githubrepo", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
     "start": "node node_modules/react-native/local-cli/cli.js start", 
     "test": "jest" 
    }, 
    "dependencies": { 
     "axios": "^0.16.2", 
     "native-base": "^2.3.2", 
     "react": "16.0.0-alpha.12", 
     "react-native": "0.48.3", 
     "react-navigation": "^1.0.0-beta.11" 
    }, 
    "devDependencies": { 
     "babel-jest": "21.0.2", 
     "babel-preset-react-native": "4.0.0", 
     "jest": "21.1.0", 
     "react-test-renderer": "16.0.0-alpha.12" 
    }, 
    "jest": { 
     "preset": "react-native" 
    } 
} 
+0

您正在使用的WebPack?它爲你做到了。 –

+0

我使用反應本地和不知道它是否有webPack,但有package.json – amorenew

+1

Package.json獨立於webpack,但它可能包含腳本來運行該應用程序。你可以給我發送你的package.json –

回答

0

如果您使用的是出口的關鍵字,e.g:

export class LoginScreen..... etc 

進口可以通過做管理:

import { LoginScreen } from Paths 
+0

我知道出口,但如果我做了多個出口,會影響性能呢? – amorenew

+0

導出登錄和導出註冊是所有類將被加載,如果我導入路徑類 – amorenew