我想将日期转换为字符串,但我得到了渲染[object Object]。我做错了什么?
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
class Date extends Component {
constructor(props) {
super(props);
}
render() {
var testD = new Date();
return (
<div className="date">
<div className="date__show">{testD.toString()}</div>
<button>Clear</button>
</div>
)
}
}
function mapStateToProps(state){
return {
testState: state
};
}
export default connect(mapStateToProps)(Date);
我想将日期转换为字符串,但我得到了渲染[object Object]。我做错了什么?