Skip to content

Instantly share code, notes, and snippets.

@casprwang
Created January 2, 2017 14:29
Show Gist options
  • Save casprwang/3060c5c5795a4e18976b2c22d9c555be to your computer and use it in GitHub Desktop.
Save casprwang/3060c5c5795a4e18976b2c22d9c555be to your computer and use it in GitHub Desktop.
component with state with {}
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