Just Grinding

You can never expect to succeed if you only put in work on the days you feel like it

I finished the recipe box project of FCC. I am making progress albeit slowly. I ran into another React quirk too. So this project wanted you to store the recipes in local storage so that if the user added/edited/deleted, any of those changes would be there when the page was refreshed. So adding and editing were working fine but deleting was not. I would delete a recipe and it would render on the page correctly but when the page was refreshed it would revert back to the undeleted version.

After, racking my brains for a bit there trying different things and re-reading the docs, the issue turned out to be I was invoking localstorage.setItem immediately after setState and before it actually reflected the changes. So moving the localstorage call to the componentDidUpdate method fixed the issue. It also streamlined my code because instead of having to create my own update() function that was called from three different functions I could just let the lifecycle method handle it.

So now on to the next project. I was a little down, because my coding hours were way below the 21 hours a week I originally wanted. But I am making progress, and I do not want to sacrifice my health, sanity or family just to try to hit 20 hours a week. I finished reading “The One Thing” this week and it helped me to see that as long as I am working towards my goal it is a win. So I am just gonna keep on grinding!

Leave a Comment