A live preview has been deployed to Netlify and is available here.
This is a checklist of clipboards implemented from the given Figma board.
- Homescreen.
- Selection.
- Waiting to be matched.
- Now in game - toast.
- Now in game.
- Game screen(s).
- Adding Again to the win status when a player wins consecutively. E.g X Wins Again.
-
In
handleTileClick
function, thetiles
state hooks is being copied into a new array to avoid directly mutating the index without using thesetTiles
. After the indexes have been updated, the copied array is set to thetiles
state using thesetTiles
hook. -
The
tiles
component state is initialized tonull
values. This makes it easier to check the elements within the array by checking for falsy values. -
Due to limited time given, the application state is being managed within components using Hooks and the navigation Hook state. A more more elaborate approach be to create a global store using a state management library such as Redux or the Context API.
-
For managing the major application views within a page,
if
statements are being used over ternary operators to improve code readability as ternary operators could become diffcult to mentally understand when used over a large block of code.
Although these goals were not identified in the task description, these are stretch goals that I will love to implement later on.
- Persisting the
userGameRecord
component state in browser's local storage. - Introduce the React context API for better state management.
- Adding React Error Boundaries to catch errors that might occur in the
game
page. - Profiling the application performance using the React Profiler.
- Creating sufficent unit tests for the helper functions created using Jest.
- Creating automated E2E tests using Cypress to test each page.