The other day, I saw the YouTube video where the guy from Netlify was live-coding a Sudoku app from scratch, and I decided to try it for myself. Unfortunately, I got stuck at the part where he is coding the SudokuField component, specifically the part where he validates the input to a specific field and gets it to “suppress” non-integer values that fail the parseInt call.
My problem is that whenever I try to run this code, I get all kinds of ReferenceErrors anytime I type something in any field. The errors mention that the variable “value” is used before it gets initialized on line 5 of the SudokuField component. I’ve even gone so far as to copy the entire body of the component from the repo into my own project, and I still get the error, so I have no idea how he manages to get it working. Does anyone else know what I’m doing wrong, or what’s wrong with this code? It’s otherwise a pretty cool video and I’d love to be able to finish this app, but I can’t seem to get past this issue.
- Link to video: https://www.youtube.com/watch?v=GytUZLK4kwA
- Link to GitHub repo with the code from the video: https://github.com/biilmann/sudoku-stack
- 32:23 shows the finished component in question.
- 37:38 shows him trying to type non-Integer values on the keyboard and the app successfully prevents them from showing up on the field.