class Game {
constructor( ... ) {
...
this.players = [];
}
}
class Player {
constructor( ... ) {
...
this.cards = [];
}
}
render() {
const { _sharedData: { auth_user } } = this.props;
const shouldShowIconMenu = +auth_user === 1;
return (
<AppBar>
{shouldShowIconMenu && (
<IconMenu>
...
</IconMenu>
)}
{!shouldShowIconMenu && <SomeThingElse />}
</AppBar>
);
}
render() {
const { _sharedData: { auth_user } } = this.props;
const shouldShowIconMenu = +auth_user === 1;
return (
<AppBar>
{shouldShowIconMenu ? (
<IconMenu>
...
</IconMenu>
) : (
<SomeThingElse />
)}
</AppBar>
);
}
render() {
const { _sharedData: { auth_user } } = this.props;
const shouldShowIconMenu = +auth_user === 1;
const innerContent = shouldShowIconMenu ? (
<IconMenu>
...
</IconMenu>
) : (
<SomeThingElse />
);
return (
<AppBar>
{innerContent}
</AppBar>
);
}
renderIconMenu() {
const { _sharedData: { auth_user } } = this.props;
const shouldShowIconMenu = +auth_user === 1;
return shouldShowIconMenu ? (
<IconMenu>
...
</IconMenu>
) : (
<SomeThingElse />
);
}
render() {
const { _sharedData: { auth_user } } = this.props;
return (
<AppBar>
{this.renderIconMenu()}
</AppBar>
);
}
Уверены, что селектор срабатывает?
root лучше так написать: