Last active
August 29, 2015 14:25
-
-
Save fukajun/729f14fa1e7eef616d39 to your computer and use it in GitHub Desktop.
This file contains 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 Appp extends React.Component{ | |
constructor(props) { | |
super(props) | |
this.state = { | |
counter: 0 | |
} | |
} | |
change(e) { | |
console.log(e.target.value) | |
console.log(this.refs) | |
this.setState({ counter: e.target.value }) | |
} | |
incrementCounter() { | |
var counter = this.state.counter + 1 | |
this.setState({ counter: counter }) | |
} | |
render() { | |
return ( | |
<div> | |
<span>{this.state.counter}</span> | |
<input type='text' ref='1' /> | |
<input type='text' onChange={this.change.bind(this)} value={this.state.counter} /> | |
<input type='button' value='押して'onClick={this.incrementCounter.bind(this)}/> | |
</div> | |
) | |
} | |
} |
This file contains 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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head charset="utf-8"> | |
<title>sendagaya.rb react/title> | |
<link href='./style.css' rel='stylesheet'></link> | |
<link href='./react-datepicker.min.css' rel='stylesheet'></link> | |
</head> | |
<body> | |
<div id="target"></div> | |
<script src="build/bundle.js"></script> | |
</body> | |
</html> |
This file contains 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' | |
import { Appp } from './containers/App' | |
console.log(Appp) | |
React.render( | |
<div><Appp /></div>, | |
document.getElementById('target') | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment