So far just about everything in the advanced react course has already been completed. Every box that you can check has been checked and all the code has been completed for me. A bit counter productive.
This is not a Codecademy’s bug.
Tried it in a sandbox of React, and the same happens.
Seems to have a disconnection between rendering and actually displaying the content of the DOM on screen. I searched a lot for it on Google, but found nothing so far.
Some clarification from the authors would be appreciated.
I have a feeling I am not the only that has been feeling frustrated since the second half of the Web Dev course started. Courses are often like drafts with little or wrong details, too simplistic, sometimes have bugs and “hints” were dropped altogether. This might not be the place to post that, but where else? Codecademy didn’t even reply to the questions in this thread…
In part 1/5, under “What’s a lifecycle method?”, it says…
You can write a lifecycle method that gets called right after a component renders, every time except for the first time.
I assume it is referring to componentDidMount, as taught in part 5/5, but from my understanding what actually happens is the opposite of the above quote. componentDidMount is called only once, after the first render of the component. Any subsequent render of the component does not invoke the componentDidMount method. The part 5/5 exercise seems to prove that.
Can someone confirm this just so I’ve understood the functionality of componentDidMount correctly?
It wasn’t necessary to bind this because of the arrow function that was used. Arrow functions use lexical scoping and maintains the reference necessary to be able to call this.setState(). Here’s an article about some differences: Learn ES6 The Dope Way Part II: Arrow functions and the ‘this’ keyword
To further explain and demonstrate, if we add a console.log(this) here:
isPrecise is a prop being sent to the Clock component. We only have access to Clock.js in this lesson, but we do know that it’s a boolean. The purpose of it is to tell our clock how often the time should be updated. The default is 1 second, but “precise” mode is every 100ms. You’ll be building out this functionality during the lesson.