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
constructor(props) { | |
super(props); | |
this.state = { | |
items: [] | |
}; | |
} | |
componentDidMount() { | |
fetch("http://example.com/api/endpoint/") | |
//fetch("https://cors.io/?http://example.com/api/endpoint/") |
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
class NameForm extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
value: "" | |
}; | |
this.handleChange = this.handleChange.bind(this); | |
} | |
handleChange(event) { |
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
class SomeComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
value: 1 | |
}; | |
} | |
handleButtonChange() { | |
this.setState({ |
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
var users = [ | |
{ id: 1, name: "Chris" }, | |
{ id: 2, name: "Jeff" }, | |
{ id: 3, name: "Julie" }, | |
{ id: 4, name: "Jessica" } | |
]; | |
class UserList extends React.Component { | |
render() { | |
var users = this.props.users; |
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
var users = [ | |
{ id: 1, name: "Chris" }, | |
{ id: 2, name: "Jeff" }, | |
{ id: 3, name: "Julie" }, | |
{ id: 4, name: "Jessica" } | |
]; | |
function UserList(props) { | |
var users = props.users; | |
var usersListItems = users.map(function(user) { |
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
var forecast = [ | |
{ day: "Monday", sun: true, humidity: 10 }, | |
{ day: "Tuesday", sun: false, humidity: 100 }, | |
{ day: "Wednesday", sun: false, humidity: 100 }, | |
{ day: "Thursday", sun: true, humidity: 25 }, | |
{ day: "Friday", sun: false, humidity: 100 }, | |
{ day: "Saturday", sun: true, humidity: 15 }, | |
{ day: "Sunday", sun: false, humidity: 100 } | |
]; |
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
do { | |
text += "The number is " + i; | |
i++; | |
} | |
while (i < 10); |
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
while (i < 10) { | |
text += "The number is " + i; | |
i++; | |
} |
NewerOlder