
Set up a React TypeScript Connect Four project by installing NodeJS, VSCode, and width, installing dependencies, and launching the dev server; define rows, columns, colors, and constants.
Implement the drop zone above the board, track dropped marbles with a typed state, and render them positioned by x and y using absolute transforms and the current player's color.
Implement marble dropping in a React game by handling space or enter, calculating column height from dropped marbles, updating the drop zone, and toggling turns.
Animate the dropping marble and its movement in a React game using transform translate, row state, and a 500 ms CSS transition for the drop zone.
Implement winner logic by defining win types and player numbers, checking horizontal, vertical, and diagonal directions, and resetting the game with a winner component.
Set up a React + TypeScript hangman project, install dependencies, and run the boilerplate to begin coding; next, install the Jest test suite.
Install and configure testing libraries for a React and TypeScript project, set up Jest with tsconfig and setup files, and run tests before starting the dev server.
Implement a letter-guessing mechanic for a hangman game using React and TypeScript, tracking correct and incorrect guesses, handling on-guess logic, and disabling already guessed letters with accessible styling.
Build and integrate a win/lose pop-up for a React hangman game that handles game reset, displays win or lose status, and supports replay after success or failure.
Implement an overlay layer as a separator atop the tiles by rendering 16 overlay cells with 10px borders. Disable pointer events and use z-index to stack overlays above the tiles.
Implement a move tile mechanic on the board by swapping the clicked tile with an adjacent tile, using index checks to ensure valid moves and updating the tiles accordingly.
animate the tiles with smooth left and top transitions using style.css, set a 0.4s ease in out, and block rapid clicks by an animating state until the animation finishes.
Handle keyboard events to move tiles with arrow keys. Use useEffect and useCallback to manage keydown listeners, cleanup on unmount, and coordinate tile moves with animations.
Detect the winning condition by checking all tiles match their index, render a winner overlay, and reset the game by shuffling tiles with a reset function for retries.
Implement a game button that resets state, connect a game component with a reset prop, and wire it to the board and winner for restarting play in React and TypeScript.
Build a lights out game in React TypeScript on a configurable grid where a click toggles a light and its neighbors, aiming to turn all lights on or off.
Implement a two-tone title component in a React app, styling orange and blue spans with a flicker animation and keyframes to create an eye-catching header.
Create a five by five grid board in react typescript, implement a grid generator that toggles a cell and its neighbors to produce a solvable lights-out grid, test with jest.
Create a cell component to separate board and cells. The cell receives row index, column index, and a boolean status, and renders an on or off circle with CSS.
toggle the lights on a grid by clicking a cell, flipping that cell and its four neighbors, using a copied board state and a use callback to optimize rendering.
To install and config Jest and dependencies,
1- run this command on your terminal
npm install -D jest @testing-library/react ts-jest @types/jest ts-node @testing-library/jest-dom jest-environment-jsdom @testing-library/user-event
2-Create a file named: jest.setup.ts in your project folder with this content:
import "@testing-library/jest-dom";
3-Create a file named: jest.config.js with this content:
export default {
testEnvironment: "jsdom",
transform: {
"^.+\\.tsx?$": "ts-jest",
},
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
};
4-Open tsconfig.json and add replace everything with:
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
],
"compilerOptions": {
"esModuleInterop": true,
}
}
5-Go to package.json and under scripts
Replace the line starting with “dev” with these two lines
"dev": "npm run test && vite",
"test": "jest --passWithNoTests",
Images
The whole images set used for this lesson can be found in the FreePik website. Please visit external link for this video
Learn to implement a card matching game in React by wiring click handlers, tracking first and second cards, revealing matches, and resetting state for non-matches.
Reveal cards on mismatch, reset after a timeout, and manage reveals using a boolean is revealed prop to show two cards at a time, while disabling extra clicks until reset.
Track and display the turn in a React memory game, updating it on card reveal and resetting to zero with an init game, plus a new game control.
Set up a React and TypeScript project for mastermind, configure Jest and testing libraries, wire Redux and context for data flow, and bootstrap the app scaffolding for development.
Implement the mastermind app's four components: secret, rows, colors, and buttons, with a centered 600px board, CSS grid layouts, and an ubuntu font.
Build a row with an index, circles for guesses, and hints; make circle colors optional and default to transparent, and tune flex layout with space-around and a transparent rgba color.
Define the game state type and an init game state helper that sets current row, current color, 2D rows, hints, a new secret from color options, and an ongoing state.
Highlight the active row and active color by reading current row and current color from app state via app context, applying an active class and css border.
Set the active color by dispatching a set color action through the context API, defining action types and payloads, and wiring circle clicks to update the reducer state.
Implement a set slot action and reducer to color a clicked slot using the column number as payload, update the current row, and dispatch via the context API.
Implement row checking in a mastermind-like game by rendering colored circles, enabling the check button when four colors exist, and computing hints by comparing the guess to the secret.
Select a random word from a predefined list, implement a helper to pick it, write tests, and wire the result to state with useEffect for a new word.
Handle key strokes in a React word game by reading keyboard events, normalizing to uppercase, enforcing a five-letter limit, and updating the word with backspace and enter to advance rows.
Wire the keyboard component to the app.tsx onkeydown handler, handle letter keys, enter, and backspace as strings or keyboard events, and style active keys for visible feedback.
Unlock the full potential of React with this comprehensive, hands-on course where you’ll master modern web development by building seven classic games. This course is perfect for developers with a basic understanding of React, TypeScript, and CSS, looking to elevate their skills through practical, engaging projects.
Throughout the course, you'll create a variety of well-known games including Connect 4, Wordle, Master Mind, Memory Game, Lights Out, Hangman, and the 15 Puzzle. Each project is designed to deepen your understanding of React’s core concepts, such as components, hooks, and state management, while also introducing you to advanced techniques like Context API and Redux for effective state handling.
You’ll also learn how to write unit tests using Jest to ensure your applications function as intended. You will also learn more about code-splitting and separation of concerns in web applications.
Whether you’re an aspiring web developer or a seasoned programmer looking to refine your skills, this course provides detailed explanations and hands-on experience to help you build interactive, high-performance applications. By the end of the course, you'll not only have a portfolio of classic games but also a solid foundation in both React and TypeScript, ready to tackle more complex projects and advance your career in web development.