Skip to content

Instantly share code, notes, and snippets.

// SyntheticEvent
// 'this' inside your event handler refers to the component the event handler lives in
class PlusButton extends React.Component {
render(){
const buttonStyle= {
fontSize: '1em',
width: 30,
height: 30,
const List = props => (
<ul>
{
props.items.map( (item, index) => <li key={index}>{item}</li> )
}
</ul>
)
class TodoList extends React.Component {
constructor(props) {
class ColorCard extends React.Component {
constructor(props) {
super(props);
this.state = {color: ''};
this.handleSubmit = this.handleSubmit.bind(this);
// this.handleChange = this.handleChange.bind(this);
}
handleSubmit(e) {
// http://stackoverflow.com/questions/10730362/get-cookie-by-name
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
class PI
@@TIME = 10000000
attr :circle, :square
def initialize
@circle = 0
@square = 0
calculate_pi
end