You will learn how to write the reducer for the counter application in a test driven development way, as well as the conventions in implementing reducers.
Would you mind explaining more as to why you define counter
as a const and an arrow function? What is meant by it has clearer semantics? Thanks so much, really enjoying the series so far!
Nathaniel,
For historical reasons JS function declarations have weird semantics. "function" is not block-scoped (that it, behaves like "var" rather than like ES6 "let" or "const"), it is hoisted (a very weird thing to cloud beginners' heads with), it has "this" context which is frustrating to explain when you're just teaching some library's API, etc.
See also:
https://medium.com/@ryanflorence/functions-without-function-bc356ed34a2f
https://twitter.com/sebmarkbage/status/638531311477522433
Which library are you using for expect
?
Figured out through later episodes it is loaded through as a script tag on the HTML src="https://wzrd.in/standalone/expect@latest". Loving the series so far, same architecture as ELM but with JS!
If anyone wondering:
https://github.com/mjackson/expect
Is expect a thing from expect.js that I need to npm install? Also what environment should I use for this mini tutorial series?