When we start to accumulate functions that all work on a given datatype, we end up creating a bunch of boilerplate code in almost every function to handle the changes we need to make to our records’ values. This can lead to not only undesirable boilerplate present in all of our functions, but also can cause us to have to create variables just to manage our stateful changes.
We’ll take a look at a couple patterns that can act as early warning signs
that will eventually cause us to not have a good time. Once we know what the
smell is, we’ll look at how moving our computations into State
can clean up
all of our state management code by making it the responsibility of State
.
This allows our functions to only describe how state should change over time
versus us having to change it ourselves.
Hi everyone, I've been watching these lessons which I think are one of my favorites :) But I have a question on this video. When I get to the part where I'm using propOf the node throws an error that says:
Error: Cannot find module 'crocks/helpers/propOr'
How can I fix that? thank you1
Sorry for the trouble, propOr
is not available in crocks
yet. (It will be in the next release tho)
This lesson is using a propOr
in the helpers.js
file.
it can be found on the github here.
hope this helps!!
ohhh thanks a lot !!
Thanks! This was one of my favourite egghead courses.
Great that this mentions recognizing not great patterns and uses what we've learned to address the issue.