Verify That, Please
Yesterday and today I learned how important it is to work on a branch other than the master. I had fallen prey to the thought that "I'm only making a small change, it shouldn't matter" but, because that's the way things go, it wasn't a small change and I was left re-writing functions that I had deemed unnecessary and stupidly deleted (and then going onto my own GitHub page to compare with my old code.) It was a situation that I'm glad happened to me in a forum where no one would be impacted, and hopefully having happened once I can keep it from happening again when it really matters.
I added my Verify Page back into the flow of things, and wanted to have an optional field where a User could enter notes about a specific card. However, because I was taking everything in the DesignContainer's this.state and putting it into a JSON literal before passing it to the Verify Page, it kept telling me that my optional note was blank, so the form couldn't submit. This seemed like a symptom of a larger problem, namely that I had made things more complicated than they needed to be. I changed things around so that this.state in its entirety was passed to the Verify Page, meaning that the Note section on the Verify Page could have the same handleChange function as everything else. I added another piece to my addToJSON() function so that it would save the data in a literal, then empty this.state, then pass the data on to App and the JSON.
It's such an elegant (in my opinion) and clear solution that I don't know how I didn't think of it before.
Now my Design Form and my Verify Page will show you a mock-up of a card, and the user can choose to add a note that will be displayed later, once each card can generate its own page.
Comments
Post a Comment
Thank you for reading my blog! I look forward to hearing from you.