我现在开始了两个星期的React Native / Redux开发工作,并且mapStateToProps和重新渲染存在一些问题。
这是事实:
这是代码:
零件
import React from 'react';
import { connect } from 'react-redux';
import { View, StyleSheet } from 'react-native';
import { Item, Input, Button, Text } from 'native-base';
import { signup } from './../actions/signup.action';
class Signup extends React.Component {
constructor(props) {
super(props);
this.state = {
email: '',
password: '',
confirmPassword: ''
};
}
render() {
console.log('rendering', this.props);
return (
<View style={styles.container}>
<Item rounded>
<Input placeholder='Email' onChangeText={(text) => this.setState({email: text})} value={this.state.email} />
</Item> …Run Code Online (Sandbox Code Playgroud)