I have been attempting to implement Redux into a React-Native registration app I'm working on to create a multi page form set up.
I keep getting this error:
Please review the pertaining code here under from the app's root container:
import React, { Component } from 'react';
import ReactNative from 'react-native';
import { AppRegistry,Text,View,} from 'react-native';
import { Button } from 'react-native-elements'
import { StackNavigator } from 'react-navigation'
import store from '../store/store';
import { Provider,connect } from 'react-redux';
import Register1 from './emailandpass'
import Register2 from './namefields'
//import login from './login'
//import confirmation from './confirmation'
//import success from './success'
class Loginscreen extends React.Component{
static navigationOptions= {
title: 'Welcome to LearnD',
}
render() {
const { navigate } = this.props.navigation;
return(
<Provider store={store}>
<View>
<Text>Have you got an account ?</Text>
<Button
onPress={()=> navigate('Register1')}
title="Register here !"
/>
</View>
</Provider>
);
}
};
const App = StackNavigator({
Home: { screen: Loginscreen},
Register1: {screen: Register1 },
Register2: {screen: Register2}
});
export default connect(mapStateToProps)(Landingscreen);
Any help would be appreciated
You did not create a mapStateToProps
function yet you try to pass it to the connect
function.
You should read the DOCS for clarity
For example:
function mapStateToProps(state) {
return {
navigation: state.navigation
}
}
This will pass the navigation
from redux
store
as a prop to your component so you can access it via props.navigation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With