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
class Vote extends React.Component { | |
constructor(){ | |
super(); | |
this.state = { | |
message: "Click on an image to vote" | |
}; | |
this.voteForBuhari = this.voteForBuhari.bind(this); | |
this.voteForFela = this.voteForFela.bind(this); | |
this.voteForSowore = this.voteForSowore.bind(this); | |
} |
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
'use strict'; | |
const e = React.createElement; | |
class FollowButton extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { follow: false }; | |
} | |
render() { | |
if (this.state.follow) { | |
return 'You are following this.'; |
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
const e = React.createElement; | |
class FollowButton extends React.Component { | |
constructor(props) { | |
super(pros); | |
this.state = { follow: false }; | |
} | |
render() { | |
if (this.state.follow) { | |
return 'You are following this.'; | |
} |
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
function Dialog(props) { | |
return ( | |
<div className="dialog"> | |
<h1 className="Dialog-title"> | |
{props.title} | |
</h1> | |
<p className="Dialog-message"> | |
{props.message} | |
</p> | |
{props.children} |
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
<Dialog title="Sign up now" message="Get superpowers for free"> | |
<input name={this.state.login} onChange={this.handleLogin} /> | |
</Dialog> |
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
class SignUp extends React.Component { | |
constructor(props) { | |
super(props); | |
this.handleChange = this.handleChange.bind(this); | |
this.handleSignUp = this.handleSignUp.bind(this); | |
this.state = {username: ''}; | |
} | |
render() { | |
return ( |
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
class Login extends React.Component { | |
constructor(props) { | |
super(props); | |
this.handleChange = this.handleChange.bind(this); | |
this.handleLogIn = this.handleLogIn.bind(this); | |
this.state = {username: ''}; | |
} | |
render() { | |
return ( |
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'; | |
class App extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
id: null, | |
userId: 1, | |
food: '', |
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' | |
const AddFoodItemForm = props => { | |
return ( | |
<form onSubmit={ props.addFoodItem } className="col-sm-4"> | |
<div> | |
<div> | |
<label className="text-white">Food name</label> | |
<input type="text" name="food" value={props.food} onChange={ props.handleInputChange}/> | |
</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
import React from 'react' | |
const EditFoodItemForm = props => { | |
return ( | |
<form className="col-sm-4"> | |
<div> | |
<div> | |
<label className="text-white">Food name</label> | |
<input type="text" name="food" value={props.food} onChange={ props.handleInputChange}/> | |
</div> |
OlderNewer