I have a technical interview Monday.
These are so often intimidating, either because they may throw in obscure-ish "gotchas", or just the general issue that 90%+ of, say, React work is done in a context where the basics are setup, and every new component for feature is the appropriate variation of something that already exists. But most tests are throwing you up against something new and closer to greenfield (even they are asking you to "find the mistakes in this code")
Anyway. Sometimes in these cases I like going back to basics, like going through tutorials and hands on stuff so I regain fluency in low level stuff.
The React site has a Tic Tac Toe tutorial. You are given the option of editing it in codesandbox, or from there you can hit "export to zip" and run it locally, which seemed like the richer option to me. But if you do so you are likely to see this error:
./src/App.js
Line 2: 'React' must be in scope when using JSX react/react-in-jsx-scope
The solution is to explicitly import React at the top:
Not sure why the demo there doesn't have/need that.
Also doing a simple "2 player only Tic Tac Toe" game (i.e. no AI to play against) was one of the first programs I remember writing in BASIC on Atari 8bit computers (the 800XL). What's funny is I used the same basic algorithm for detecting if the game was over that the React demo uses (just seeing if any of the square sets representing the 8 possible ways of "winning" the game were filled with the same player's marks.) I remember as precocious...4th grader? 5th grader? explaining that technique to my Aunt, and her saying it was the kind of thing she didn't think that she could come up with. No wonder I was so full of myself as a kid. (Sure, only as a kid)
No comments:
Post a Comment