我有在grammar Verb {
token TOP {
<root>
<ending>
}
token root {
(\w+) <?{ ~$0 (elem) @root }>
}
token ending {
(\w+) <?{ ~$0 (elem) @ending }>
}
}
my @root = <go jump play>;
my @ending = <ing es s ed>;
my $string = "going";
my $match = Verb.parse($string);
.Str.say for $match<root>;
订阅的组件:
auth
当我在嵌套组件中更改存储时,RequireAuthComponent也会重新渲染,但export default function requireAuthComponent(Component, redirectTo = '/') {
class RequireAuthComponent extends React.Component {
shouldComponentUpdate(nextProps) {
return nextProps.auth.logged !== this.props.auth.logged;
}
render() {
const { auth } = this.props;
if (auth.logged) {
return <Component {...this.props} />;
}
return <Redirect to={redirectTo} />;
}
}
return connect(({ auth }) => ({ auth }))(RequireAuthComponent);
}
存储没有更改,但如果我在auth
中添加了比较auth
存储,则它可以正常工作。为什么redux不会比较componentShouldUpdate
自己存储,在文档中说react-redux比较存储和重新渲染组件,如果在mapStateToProps中传递的旧商店和新商店不相等?
auth