class Editor extends React.Component {
onSubmit(event) {
event.preventDefault();
console.log(event);
}
render() {
return (
// insert code here
);
}
}
class Editor extends React.Component {
onSubmit(event) {
event.preventDefault();
console.log(event);
}
render() {
}
}
const styles = {
editor: {
padding: '0 20px',
marginBottom: '20px',
},
input: {
padding: '10px',
width: 'calc(100% - 20px)',
},
};
class App extends React.Component {
constructor(props) {
/* insert code here */
}
addMessage(newMessage) {
/* insert code here */
}
}
class App extends React.Component {
constructor(props) {
super(props);
this.state = {messages: messages};
this.addMessage = this.addMessage.bind(this);
}
addMessage(newMessage) {
const currentMessages = this.state.messages;
const currentPlusNewMessages = currentMessages.concat(newMessage);
this.setState({messages: currentPlusNewMessages});
}
render() {
return (
/* existing code */
/* existing code */
<Editor addMessage={this.addMessage} />
);
}
}
class Editor extends React.Component {
constructor(props) {
/* insert code here */
}
sendMessage(event) {
/* insert code here */
}
}
class Editor extends React.Component {
constructor(props) {
super(props);
this.sendMessage = this.sendMessage.bind(this);
}
sendMessage(event) {
event.preventDefault();
const form = event.target;
const text = form.text.value;
const timestamp = new Date();
const name = 'Some name';
const {addMessage} = this.props;
addMessage({avatarUrl, name, text, timestamp});
}
render() {
return (
);
}
}
class Editor extends React.Component {
constructor(props) {
/* insert code here */
}
onChange(event) {
/* insert code here */
}
render() {
return (
);
}
}
class Editor extends React.Component {
render() {
return (
);
}
}
render() {
if (this.state.isBarking) {
return (
<HugeDog />
);
}
return (
<TinyDog />
);
}
const FakeLoginScreen = ({login}) => {
return (
);
};
const styles = {
form: {
width: '230px',
margin: 'auto',
},
input: {
width: '100%',
fontSize: '20px',
},
button: {
display: 'block',
width: '100%',
fontSize: '20px',
},
};
const multiplyBy10 = (number) => number * 10;
array.map(multiplyBy10);
function logArguments(innerFunction) {
return (...args) => {
console.log("calling with", args);
return innerFunction(...args);
};
}
const add = (a, b) => a + b;
const addWithLogging = logArguments(add);
addWithLogging(7, 9);
logArguments(add)(7, 9)