Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
try storing username in state object
Browse files Browse the repository at this point in the history
  • Loading branch information
pacificpelican committed Jun 15, 2017
1 parent adb4325 commit 6c7f166
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ychat",
"version": "0.5.0",
"version": "0.5.2",
"private": true,
"dependencies": {
"react": "^15.5.4",
Expand Down
9 changes: 5 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function getloggedinuser() {
});
}

const currentuser = getloggedinuser();
const thisuser = getloggedinuser();

console.log(socket);
socket.on('news', function (data) {
Expand Down Expand Up @@ -123,7 +123,7 @@ class MyInput extends Component {
}

class App extends Component {
state = { theuser: {currentuser} };
state = { theuser: thisuser };

constructor() {
super();
Expand Down Expand Up @@ -154,11 +154,12 @@ class App extends Component {
console.log("thisuser")
console.log(thisuser);
});
console.log('username in render function: ' + thisuser);
console.log('username in render function: ');
console.log(this.state.theuser);
if ((params !== 'undefined') && (params !== undefined)) {
return (
<div className="App">
<MyInput loggeduser={thisuser} />
<MyInput loggeduser={this.state.theuser} />
</div>
);
}
Expand Down

0 comments on commit 6c7f166

Please sign in to comment.