简体   繁体   中英

return outside of function (react-native)

hello everyone i try to run this tuturial https://firebase.googleblog.com/2016/01/the-beginners-guide-to-react-native-and_84.html in my app but i have some error.

这是我的错误

my code is :

          import React, {Component} from 'react';
          import ReactNative from 'react-native';
          import * as firebase from 'firebase';
          const StatusBar = require('./components/StatusBar');
          const ActionButton = require('./components/ActionButton');
          const ListItem = require('./components/ListItem');
          const styles = require('./styles.js');

          _renderItem(item)
                     {
                       return(
                               <ListItem item="{item}" 
                                       onpress="{()"  ==""> {}}/>
                               );
                      }

In React you do not have to put quotes on dynamic parameters:

<ListItem item={item} onpress={() => {}}/>

I don't know how you came to have : "{()" ==""> { . Maybe a copy/past bad behavior...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM