Skip to content

Commit 088705b

Browse files
committed
access state
1 parent 45f8bd5 commit 088705b

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import React, { Component } from 'react';
2+
import { connect } from 'react-redux';
23

34
class Header extends Component {
5+
renderContent() {
6+
switch (this.props.auth) {
7+
case null:
8+
return 'Still deciding';
9+
case false:
10+
return 'im loggedout';
11+
default:
12+
return 'im logged in';
13+
}
14+
}
15+
416
render() {
517
return (
618
<nav>
@@ -9,14 +21,16 @@ class Header extends Component {
921
Emaily
1022
</a>
1123
<ul className="right">
12-
<li>
13-
<a>Login With Google</a>
14-
</li>
24+
{this.renderContent()}
1525
</ul>
1626
</div>
1727
</nav>
1828
);
1929
}
2030
}
2131

22-
export default Header;
32+
function mapStateToProps({ auth }) {
33+
return { auth };
34+
}
35+
36+
export default connect(mapStateToProps)(Header);

0 commit comments

Comments
 (0)