I am trying to connect Redux mapStateToProps() and mapActionCreators() to Login Screen through Container and I am using React navigation.
After build my app the following error message appears:
_react["default"].memo is not a function. (In '_react["defaults"].memo(connectFunction)', '_react["defaults"].memo' is undefined.
I searched for a while but what I have gotten is that React.memo() helps us control when our components rerender but I don't use any code related to React.memo().
Login Screen: (screens/LoginScreen/index.js)
import React from 'react';
import {Dimensions, View} from 'react-native';
//Get width of mobile screen
var width = Dimensions.get("window").width;
var height = Dimensions.get("window").height;
export default class LoginScreen extends React.Component {
constructor(props){
super(props);
this.state = {
}
}
render() {
return (
<View style={styles.container}>
<Text>Log In page</Text>
</View>
);
}
}
LoginScreen.defaultProps = {
}
const styles = {
container: {
flex: 1
}
}
Login screen container: (containers/LoginContainer/index.js)
import {connect} from "react-redux";
import LoginScreen from "../../screens/LoginScreen";
const mapStateToProps = (state) =>({
});
const mapActionCreators = {
};
export default connect(mapStateToProps, mapActionCreators)(LoginScreen);
Top level navigation: (navigations/TopLevelSwitchNav.js)
import {createSwitchNavigation, createAppContainer} from 'react-navigation';
import LoginScreen from '../containers/LoginContainer';
import MainTabNav from './MainTabNav';
const TopLevelSwitchNav = createSwitchNavigation({
Login: {
screen: LoginScreen,
navigationOptions: {
header: null
}
},
MainTab: {
screen: MainTabNav,
navigationOptions: {
header: null
}
}
},
{
initialRouteName: Login,
navigationOptions: { header: null }
});
export default createAppContainer(TopLevelSwitchNav);
Dependencies:
"dependencies": {
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-navigation": "^3.8.1",
"react-redux": "^7.0.2",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0",
"redux-persist-transform-filter": "^0.0.18",
"redux-thunk": "^2.3.0"
},