Skip to content

Commit 9c523dc

Browse files
authored
Move Lesson 10 exercises and activities (#20)
Exercises and activities should be numbered globally
1 parent f635cc4 commit 9c523dc

File tree

117 files changed

+363
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+363
-374
lines changed

Lesson10/.gitignore

100644100755
File mode changed.

Lesson10/01-first-class/.babelrc

100644100755
File mode changed.

Lesson10/01-first-class/example-1-functions-as-values.js

100644100755
File mode changed.

Lesson10/01-first-class/example-10-this-react-issues.html

100644100755
File mode changed.

Lesson10/01-first-class/example-10-this-react-issues.js

100644100755
File mode changed.

Lesson10/01-first-class/example-2-inversion-of-control.js

100644100755
File mode changed.

Lesson10/01-first-class/example-3-add-event-listener.js

100644100755
File mode changed.

Lesson10/01-first-class/example-4-fs-readdir-callback.js

100644100755
File mode changed.

Lesson10/01-first-class/example-5-fetch-then.js

100644100755
File mode changed.

Lesson10/01-first-class/example-6-fs-readdir-promise.js

100644100755
File mode changed.

Lesson10/01-first-class/example-7-array-first-class.js

100644100755
File mode changed.

Lesson10/01-first-class/example-8-parent-child-react.html

100644100755
File mode changed.

Lesson10/01-first-class/example-8-parent-child-react.js

100644100755
File mode changed.

Lesson10/01-first-class/example-9-child-parent-react.html

100644100755
File mode changed.

Lesson10/01-first-class/example-9-child-parent-react.js

100644100755
File mode changed.

Lesson10/01-first-class/exercise-1-re-implement-array-methods-start.js

-20
This file was deleted.

Lesson10/01-first-class/exercise-1-re-implement-array-methods.js

-20
This file was deleted.

Lesson10/01-first-class/exercise-3-on-checkout-prop-start.html

-2
This file was deleted.

Lesson10/01-first-class/exercise-3-on-checkout-prop-start.js

-76
This file was deleted.

Lesson10/01-first-class/exercise-3-on-checkout-prop.html

-2
This file was deleted.

Lesson10/01-first-class/exercise-3-on-checkout-prop.js

-75
This file was deleted.

Lesson10/01-first-class/exercise-4-add-product-start.html

-2
This file was deleted.

Lesson10/01-first-class/exercise-4-add-product.html

-2
This file was deleted.

Lesson10/01-first-class/exercise-5-render-prop-start.html

-2
This file was deleted.

Lesson10/01-first-class/exercise-5-render-prop.html

-2
This file was deleted.

Lesson10/01-first-class/package.json

100644100755
File mode changed.

Lesson10/01-first-class/test.js

100644100755
File mode changed.

Lesson10/02-pure/example-1-double-test.js

100644100755
File mode changed.

Lesson10/02-pure/exercise-1-redux-dispatch-start.html

-2
This file was deleted.

Lesson10/02-pure/exercise-1-redux-dispatch.html

-2
This file was deleted.

Lesson10/02-pure/exercise-3-items-selector-start.html

-2
This file was deleted.

Lesson10/02-pure/exercise-3-items-selector.html

-2
This file was deleted.

Lesson10/02-pure/package.json

100644100755
File mode changed.

Lesson10/03-higher-order/example-1-react-bind.html

100644100755
File mode changed.

Lesson10/03-higher-order/example-1-react-bind.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-2-test-parameter-bind.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-3-function-prototype-bind-call.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-4-array-like-array.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-5-sum-curried.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-6-partial-sum.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-7-generic-curry.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-8-revealing-module.js

100644100755
File mode changed.

Lesson10/03-higher-order/example-9-function-comp-react.html

100644100755
File mode changed.

Lesson10/03-higher-order/example-9-function-comp-react.js

100644100755
File mode changed.

Lesson10/03-higher-order/package.json

100644100755
File mode changed.

Lesson10/04-composition/example-1-sum-simple-compose.js

100644100755
File mode changed.

Lesson10/04-composition/example-2-micro-hello.js

100644100755
File mode changed.

Lesson10/04-composition/example-3-request-timer.js

100644100755
File mode changed.

Lesson10/04-composition/example-4-api-key-auth.js

100644100755
File mode changed.

Lesson10/04-composition/example-5-express-api-key-auth.js

100644100755
File mode changed.

Lesson10/04-composition/package.json

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-1-redux-action-creator.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-2-immutable-map-filter-reduce.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-3-immutable-object-rest-spread.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-4-immutable-array-rest-spread.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-5-immutable-object-freeze.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-6-component-did-mount-request.html

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-6-component-did-mount-request.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-7-use-effect-request.html

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-7-use-effect-request.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-8-thunk-usage.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-9-redux-thunk-request.html

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/example-9-redux-thunk-request.js

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/exercise-1-refactor-action-creators-start.html

-2
This file was deleted.

Lesson10/05-immutability-side-effects/exercise-1-refactor-action-creators.html

-2
This file was deleted.

Lesson10/05-immutability-side-effects/exercise-2-map-to-props-start.html

-2
This file was deleted.

Lesson10/05-immutability-side-effects/exercise-2-map-to-props.html

-2
This file was deleted.

Lesson10/05-immutability-side-effects/package.json

100644100755
File mode changed.

Lesson10/05-immutability-side-effects/schema.graphql

100644100755
File mode changed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<div id="app"></div>
2+
<script src="./activity-1-on-checkout-prop-start.js">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Run this with
2+
// npm run activity1
3+
import React from 'react';
4+
5+
import ReactDOM from 'react-dom';
6+
7+
class Basket extends React.Component {
8+
constructor() {
9+
super();
10+
this.state = {
11+
items: [
12+
{
13+
quantity: 1,
14+
price: 199,
15+
name: 'Soda bottle'
16+
},
17+
{
18+
quantity: 2,
19+
price: 2499,
20+
name: 'Kitchenware kits'
21+
}
22+
]
23+
};
24+
}
25+
26+
render() {
27+
return (
28+
<div>
29+
<p>You have {this.state.items.length} items in your basket</p>
30+
<button onClick={() => {}}>Proceed to checkout</button>
31+
</div>
32+
);
33+
}
34+
}
35+
36+
class App extends React.Component {
37+
constructor() {
38+
super();
39+
this.state = {
40+
status: 'SHOPPING'
41+
};
42+
this.handleCheckout = this.handleCheckout.bind(this);
43+
this.continueShopping = this.continueShopping.bind(this);
44+
this.finish = this.finish.bind(this);
45+
}
46+
47+
handleCheckout(basket) {
48+
this.setState({
49+
status: 'CHECKING_OUT',
50+
basket
51+
});
52+
}
53+
54+
continueShopping() {
55+
this.setState({
56+
status: 'SHOPPING'
57+
});
58+
}
59+
60+
finish() {
61+
this.setState({
62+
status: 'DONE'
63+
});
64+
}
65+
66+
render() {
67+
return (
68+
<div>
69+
{this.state.status === 'CHECKING_OUT' && (
70+
<div>
71+
<p>
72+
You've started checking out with {this.state.basket.length} items.
73+
</p>
74+
<button onClick={this.continueShopping}>Continue shopping</button>
75+
<button onClick={this.finish}>Finish</button>
76+
</div>
77+
)}
78+
{this.state.status === 'SHOPPING' && (
79+
<Basket onCheckout={this.handleCheckout} />
80+
)}
81+
{this.state.status === 'DONE' && <p>Done</p>}
82+
</div>
83+
);
84+
}
85+
}
86+
87+
ReactDOM.render(<App />, document.querySelector('#app'));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<div id="app"></div>
2+
<script src="./activity-1-on-checkout-prop.js">

0 commit comments

Comments
 (0)