我有这个mapStateToProps并且我想打印一个console.log(user.isLogged),但我需要更改它以使用显式返回而不是隐式。我怎么能改变这个?
const mapStateToProps = ({ user, retrospectives }) => (
{
userData: user.userData,
isLogged: user.isLogged,
organizations: user.organizations,
retroFinished: retrospectives.retrospective.finished,
linkToRetro: retrospectives.joinedRetro,
}
);
答案 0 :(得分:3)
而不是()
使用带有return语句的{}
const mapStateToProps = ({ user, retrospectives }) => {
console.log(user);
return {
userData: user.userData,
isLogged: user.isLogged,
organizations: user.organizations,
retroFinished: retrospectives.retrospective.finished,
linkToRetro: retrospectives.joinedRetro,
}
};
答案 1 :(得分:1)
const mapStateToProps = ({ user, retrospectives }) => console.log(user.isLogged) || ({
userData: user.userData,
isLogged: user.isLogged,
organizations: user.organizations,
retroFinished: retrospectives.retrospective.finished,
linkToRetro: retrospectives.joinedRetro,
});
答案 2 :(得分:1)
只需使用花括号而不是parens。
还使用xAxisPath.addLines(between: [CGPoint(x: padding, y: rect.size.height - 31), CGPoint(x: axisWidth, y: rect.size.height - 31)])
声明。
return