FAQs on the exercise Immutable Updates and Pure Functions
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
I watched the video on object destructuring (sp?) because even though I read the documentation on the spread mentioned by CC in two lessons (probably) before this one I was like its the yadda yadda/ ect… operator !!! This totally clears it up and I think neatly explains what else what in the exercises info dump.
yeah after spending some more time on the exercise after finding the helpful tutorials… This is not the best designed exercise and I think is possibly a bit to steep of a curve to expect. Might need a rework. There are far too many leaps forward. Not typical of CC.
This guy has gotten me through the worst parts of the full stack course; React and hopefully now Redux as well…
They’re updating the courses on this Friday the 11th, including React. Hoping for some actual working lessons.
Why is reading from a file considered a side effect? Everytime you provide a file as an input to this function, it will read it the same and produce the same output won’t it?
I think the issue is the same as one of the previous exercises where an endpoint was called in the reducer: fs is technically an API, part of Node.js.
So it’s impure because the code is actually relying on an outside library to work, and therefore has some restrictions on when it would run properly.
Also, maybe for some reason it wouldn’t run every time you called it, even with the same file? But in this narrowest sense, I would be tempted to call it a pure function.
But in the larger context, you could definitely break this reducer because surely there are some files you could input that the method wouldn’t be able to read. So that way it’s not pure.
There are definitely easier examples they could use for an impure function due to an external dependency