2017-02-19 7 views
0

ネイティブに反応し、基本コンポーネントをindex.android.jsファイルにインポートする際に問題が発生しました。私は間違っていたものを見つけることができず、この特定の問題に関する投稿を見つけることもできませんでした。間違ったことを助けてください。インポート中に予期しないトークンが返される

エラー:CounterComponent.android.js行の近くに予期しないトークンがあります。 index.android.jsに以下

import Counter from './app/components/CounterComponent' 

答えて

0

をコマンドを使用してファイルをインポート

import React, { Component } from 'react'; 
import { AppRegistry, ListView, Text, View } from 'react-native'; 

export default class Counter extends Component { 
    render() { 
     return{ 
      **<View>** 
       <Text>Counter component</Text> 
      </View> 
    }; 

    } 
} 

、復帰後にこのような何か(のためのあなたの{を交換してみてください:これだけ

import React, { Component } from 'react'; 
import { AppRegistry, ListView, Text, View } from 'react-native'; 

export default class Counter extends Component { 
    render() { 
     return (
      <View> 
       <Text>Counter component</Text> 
      </View> 
     ); 

    } 
} 
+0

を。それは問題だ。助けてくれてありがとう。 –

関連する問題