Created
January 2, 2017 14:29
-
-
Save casprwang/3060c5c5795a4e18976b2c22d9c555be to your computer and use it in GitHub Desktop.
component with state with {}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export class Header extends React.Component { | |
render() { | |
// user = { | |
// name: 'Anna', | |
// hobbies: 'Gold' | |
// } | |
let content = | |
<p> | |
content from val | |
</p> | |
if (1) { | |
content = | |
<p> | |
changed content | |
</p> | |
} | |
return ( | |
<h1> | |
{this.props.age}<br/> | |
Hello<br/> | |
{1+1}<br/> | |
{content}<br/> | |
{'hello'}<br/> | |
{ 5===2 ? 'yes': 'no' } | |
</h1> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment