1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 16:48:04 +02:00
onion/js/components/header.js

30 lines
587 B
JavaScript
Raw Normal View History

2015-05-20 16:19:40 +02:00
import React from 'react';
import AltContainer from 'alt/AltContainer';
import UserActions from '../actions/user_actions';
import UserStore from '../stores/user_store';
let Header = React.createClass({
getInitialState() {
return UserStore.getState();
},
componentDidMount() {
UserStore.listen(this.onChange)
UserActions.fetchCurrentUser();
},
onChange(state) {
this.setState(state);
},
render() {
return (
<div>hello {this.state.currentUser.username}</div>
)
}
});
export default Header;