Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Answered first 4 tests #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion koans/01-HelloWorld.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HelloWorld extends React.Component {

render() {
return (
<div>FILL ME IN!</div>
<span>Hello World</span>
);
}
}
Expand Down
4 changes: 3 additions & 1 deletion koans/02-PartiesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ class PartiesList extends React.Component {
// Doesn't this code look familiar to you?
render() {
return (
<ul className="FILL ME">
<ul className="parties-list">
<li>Party at Aperture Laboratories</li>
<li>Party at GA</li>
<li>Party at Tech Collective</li>
</ul>
);
}
Expand Down
8 changes: 6 additions & 2 deletions koans/03-WhatsYourName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,17 @@ class WhatsYourName extends React.Component {
// entered to the input there.
onNameChange(event) {
// Huh... There's something wrong here...
this.setState({bad_attribute: "ChangeME!"});
this.setState({name: event.target.value});
}

render() {
return (
<div>
<p>Hello {this.state.name}</p>
{ this.state.name === "" ?
<p>Hey there. Enter your name.</p>
:
<p>Hello {this.state.name}</p>
}
<input type="text" name="name" onChange={this.onNameChange} />
</div>
);
Expand Down
15 changes: 8 additions & 7 deletions koans/04-Quiz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,33 @@
var Answers = {
// Question #1: What is the name of the class that we extend to create components class?
// Tip: See any of the exercises
answer1: "Enter your answer here",
answer1: "Component",

// Question #2: JSX is converted directly into JavaScript. True or false?
// Tip: See the first exercise.
answer2: null, // true/false?
answer2: true// true/false?

// Question #3: What's the name of the method that must be defined in every component?
answer3: "FILL ME IN",
answer3: "render",

// Question #4: If I want to set `div` component's HTML class, what attribute
// should I declare in JSX?
// Tip: See exercise #2.
answer4: "class",
answer4: "className",

// Question #5: A component's properties can be changed after its initialization. True or false?
// Tip: See exercise #3
answer5: null, // true/false?
answer5: true, // true/false?

// Question #6: What's the name of the method for changing the component's state?
// Tip: See exercise #3
answer6: 'stateSet',
answer6: 'setState',

// Question #7: You must bind a component's methods (except `render`)
// to make it possible to change the state. True or false?
// Tip: See exercise #3
answer7: null // true/false?
answer7: false // true/false?
// You can use arrow function in ES6 to define methods and avoid binding every method
};

export default Answers;
Loading