我尝试在我的React-Native应用程序上首次实现Redux。 我遇到错误找不到变量:渲染
在我的index.js上,我调用了提供程序以使用Redux。所以我添加了一个渲染器,它触发了这个错误。
这是我的index.js文件:
//index.js
import React from "react";
import {AppRegistry} from 'react-native';
import App from './App';
import { Provider } from 'react-redux'
import Store from './redux/Store/store'
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
render(
<Provider store={Store}>
<App/>
</Provider>,
document.getElementById('root')
)
如果有用,则称为:
的应用程序组件import firebase from '@firebase/app'
import '@firebase/auth'
import React from 'react';
import { View, Text, Button, Image, TouchableOpacity, StyleSheet } from 'react-native';
import { createStackNavigator, StackActions, NavigationActions } from 'react-navigation'; // Version can be specified in package.json
import Listing from './Listing';
import Menu from './Menu';
import Login from './Login';
import TestRedux from './redux/Components/TestRedux';
firebase.initializeApp({
apiKey: "XXXXXXX",
authDomain: "XXXXXXX",
databaseURL: "XXXXXXX",
projectId: "XXXXXXX",
storageBucket: "XXXXXXX",
messagingSenderId: "XXXXXXX"
});
export class App extends React.Component {
constructor(props){
super(props);
this.state = {
user:'',
loggedAndVerifiedOrNot: false
}
firebase.auth().onAuthStateChanged((user) => {
//this.setState({ user: user })
if (user != null) {
if (user.emailVerified!=null)
{
if (user.emailVerified == true)
this.setState({loggedAndVerifiedOrNot: true})
}
}
});
}
render(){
if (this.state.loggedAndVerifiedOrNot) {
this.props.navigation.navigate('Menu');
}
else {
this.props.navigation.navigate('Login');
}
return (null)
}
}
export default createStackNavigator({
Home: {
screen: App,
},
Login: {
screen: Login,
},
Menu: {
screen: Menu,
},
Listing: {
screen: Listing,
},
TestRedux: {
screen: TestRedux,
},
},
{
initialRouteName: 'Home',
}
);
您知道此错误来自何处以及如何解决吗?
答案 0 :(得分:3)
语法是:
SELECT
review_id,
review_id NOT IN (
SELECT DISTINCT review_id
FROM review_migration_table
WHERE filter_column = 170938 and review_id IS NOT NULL)
FROM review_table
WHERE
filter_column = 170938
ORDER BY review_id ASC
还有这个
render() {
return ( ... somethingToRender ... )
}
需要在您的App组件内部,并从index.js中删除。
您不需要document.getElementById。应用程序本质上是您的根元素