How To Make Tic Tac Toe Game In React | Create Tic-Tac-Toe Using React JS

Поділитися
Вставка
  • Опубліковано 1 лют 2025

КОМЕНТАРІ • 89

  • @n0social
    @n0social 11 місяців тому +9

    FINALLY MY FIRST REACT PROJECT THAT WORKS!

  • @orlandoferazzani3639
    @orlandoferazzani3639 10 місяців тому +10

    works almost fine, but if you try it, you will see that you can put two elements on top of eachother, because it doesnt check if the box is empty

  • @iftyrahman2239
    @iftyrahman2239 Рік тому +5

    Thank you for this awesome tutorial ❤

  • @javirsagar8
    @javirsagar8 25 днів тому

    great and straightforward way😍

  • @Eclipssed
    @Eclipssed Рік тому +9

    Hey brother I really like your teaching style. A single request to make a playlist of react so that it becomes easy to access react videos only. Pleazzzzzzzzzzzzzzzzzzzzz🙏

  • @abhinavgupta1219
    @abhinavgupta1219 Рік тому

    This is awesome tutorial, i can now easily make tic tac toe game. Thanks for this ❤ best yourube channel to learn frontend development.

  • @Zetsu1307
    @Zetsu1307 11 місяців тому +3

    Great, bu there will be a bug in this game, that is once you double click on already selected box you can again do the same move. I mean, if you click once a box and you get cross, thenagain click on the same box, and then try clicking another block, you will get cross again but whereas you should get a circle.

    • @JaikumarLohana-v4t
      @JaikumarLohana-v4t 4 місяці тому

      if (count%2==0) {
      if(data[num] === "" ){
      e.target.innerHTML=``
      data[num]="x"
      setCount(count+1)
      }
      }
      if (count%2!=0) {
      if(data[num] === "" ){
      e.target.innerHTML=``
      data[num]="O"
      setCount(count+1)
      }
      }
      checkwin()
      }
      this will do

  • @warriorgaming4866
    @warriorgaming4866 7 місяців тому +2

    🎯 Key points for quick navigation:
    00:00 *🎮 Setting up Tic Tac Toe Game Board*
    - Setting up the initial game board with boxes that toggle between Cross and Circle icons.
    - Creating a reset button to clear the game board and start over.
    01:48 *🛠️ Cleaning and Configuring React Project*
    - Removing default React project elements and renaming the project.
    - Configuring folder structure and basic setup for Tic Tac Toe component.
    03:09 *🖼️ Adding Assets and Styling*
    - Importing and using game icons (Cross and Circle) from assets folder.
    - Setting up basic CSS for the game board, title, and reset button.
    09:04 *⚙️ Implementing Game Logic: Toggle Functionality*
    - Implementing toggle functionality to switch between Cross (X) and Circle (O) icons on click.
    - Managing game state with a data array to track moves and check for a winner.
    13:24 *🏆 Implementing Win Condition*
    - Creating a function to check for win conditions after each move.
    - Displaying a congratulations message and locking the board upon winning.
    17:09 *🎉 Displaying Winner and Resetting the Game*
    - Updating the title with the winner's icon and message upon winning.
    - Adding functionality to reset the game board and title after a win or reset button click.
    Made with HARPA AI

  • @franciskp9117
    @franciskp9117 10 місяців тому +4

    You videos are alright. A bit more explanation would be great. As a beginner I don't understand, why some steps are done in your tutorial.

  • @easycodingwithbg4731
    @easycodingwithbg4731 3 місяці тому

    Very Informative Sir 😘

  • @NikhilPawar151
    @NikhilPawar151 Рік тому

    Thank you for such valuable content.

  • @AlejandroMéndez-j6j
    @AlejandroMéndez-j6j 9 місяців тому +5

    Dam, some bad practices here (inerhtml, writing the blocks one by one, writing EVERYTHING in one file, box i is also box i-1...)
    But it was helpful as some way to start.

  • @joshuasappor5435
    @joshuasappor5435 Рік тому +1

    nice tutorials but please with the rows in the board i think it show be column instead. So maybe column1, column2, column3 because it almost confused me when i opened in the developer tools with chrome

  • @palanimathi4493
    @palanimathi4493 Рік тому

    Thanks for this video, Need a Javascript video continuation....

  • @dymphna_creates
    @dymphna_creates Рік тому +1

    Nice tutorial 😊

  • @ArshaqAk
    @ArshaqAk Рік тому +13

    It is not working properly

    • @govindsharma973
      @govindsharma973 10 місяців тому

      Bhai tumne data array ko tictac ka function hai na usse bahar karo sayad kaam kar jaye ye

  • @ParallelXL
    @ParallelXL Рік тому +1

    Hey I am here after like years, And I just remembered from Whom I used to learn back in those days
    So I searched easy tutorials and yeah
    Why yall changed the name and are there multiple teachers now?

    • @GreatStackDev
      @GreatStackDev  Рік тому +1

      Hi Ayan, Thanks for coming back. I find GreatStack more relevant to the content we make. Yes, now we are working as a team. Btw, I really liked your Netlify portfolio site.

    • @Letsplayxxs
      @Letsplayxxs Рік тому

      ​@@GreatStackDevhow to create username and highest score in sec.

  • @TheEnd-m5w
    @TheEnd-m5w 3 місяці тому +2

    Thankyou sir

    • @GreatStackDev
      @GreatStackDev  3 місяці тому

      You're welcome. 😊 Keep coding.

    • @TheEnd-m5w
      @TheEnd-m5w 3 місяці тому

      Sir thankyou for Your response
      Sometimes I feel very demotivated
      I think I am lost my family ,relations bcz lack of IT job 😅.
      Again thanks to you for your coding contribution on UA-cam sir❤

  • @pruthivirajrao2976
    @pruthivirajrao2976 6 місяців тому

    which website you not made pls tell whenever i search any react related query i always found your channel

  • @tebiksingh
    @tebiksingh Рік тому

    Love and guidance ❤

  • @SandeepMR26
    @SandeepMR26 Рік тому

    Awesome keep it up .
    .

  • @dancepractice805
    @dancepractice805 Рік тому +1

    It was very useful

  • @mahkamov_9
    @mahkamov_9 3 місяці тому

    Thank You

  • @tarun7453
    @tarun7453 Рік тому +1

    Nice project made it but if I click at same postion more than once the output is different

  • @devrimsarikaya
    @devrimsarikaya 11 місяців тому

    çok teşekkürler :)

  • @feekz8590
    @feekz8590 8 місяців тому +1

    i tried following your code but i have 'useState' is not defined no-undef error popping up.

  • @prakashchalke1708
    @prakashchalke1708 Рік тому

    Wonderful, friend.

  • @SBamniya
    @SBamniya Рік тому +3

    Good try, keep it up, I would suggest to study more about the logics before making video.
    You don't need multiple references for reset, you can do it in better way without multiple reference, the data that you stored could be a state, the conditions are really messed. The counter update is not the correct way either, lots if duplicacy.

  • @FullSTACKDev16
    @FullSTACKDev16 Рік тому

    cool game making bro

  • @yashlad9412
    @yashlad9412 Рік тому

    At timestamp 16:50,
    In TicTackToe Component,
    Why have you repeated the code from line 61 to 64?

  • @A11-b6e4s
    @A11-b6e4s Рік тому +2

    Bro on the next Please make a video about full stake freelancer website

  • @aymenbachiri-yh2hd
    @aymenbachiri-yh2hd Рік тому

    thank you

  • @mdsabbirhossen884
    @mdsabbirhossen884 Рік тому

    Do you need channel seo manager?

  • @clouduro5227
    @clouduro5227 6 місяців тому

    If the game results in a tie, then upon clicking on the reset button it gives error!

  • @arunkumar-pr1rg
    @arunkumar-pr1rg 9 місяців тому

    You need to explain the conditions which you are using and why you are using
    You are just saying we will set ,we will create ., but need to explain why it is needed there

  • @HamzaSuleman-u4m
    @HamzaSuleman-u4m Рік тому

    Line 11:23: 'useState' is not defined no-undef
    Line 12:22: 'useState' is not defined no-undef
    Line 20:13: 'e' is not defined no-undef
    Line 25:13: 'e' is not defined
    i am having the above issue help me

    • @jasongutierrez2548
      @jasongutierrez2548 Рік тому +1

      At 9:29 const toggle = (e,num) =>{ replace w with e

    • @salimbendag6274
      @salimbendag6274 Рік тому +2

      and for useState you need to import it " import { useState } from 'react'; "

  • @loser8198
    @loser8198 Рік тому

    Awesome

  • @Nanashi-rq7lk
    @Nanashi-rq7lk Рік тому +1

    Nice

  • @MaulanaRafinda-r8l
    @MaulanaRafinda-r8l Рік тому

    Thanks...

  • @ibrohimismoilov8345
    @ibrohimismoilov8345 Рік тому

    hi bro there is bug, where i finished game with toe. You haven't checked this situation.

  • @aswinkrishna9783
    @aswinkrishna9783 11 місяців тому +2

    why images are not showing when i import

    • @AhmadHassan-o6f
      @AhmadHassan-o6f 5 місяців тому

      Ap me image Ka path nhi dia ho ga ap ise public ke app SE import karva do

  • @Unstableaspirant
    @Unstableaspirant 4 місяці тому

    i m doing the same but titleRef is undefined showing what should i do

    • @VedantKumbharkar-f2x
      @VedantKumbharkar-f2x 2 місяці тому

      you must have written let titleRef= useRef(null); so above write import{useRef} from "react"; it would work

  • @dipankarpaul3405
    @dipankarpaul3405 Рік тому

    Please make some videos with Svelte or SvelteKit...

  • @heyyangshuman
    @heyyangshuman Рік тому

    npm create-react-app . is taking hours to install. What should I do?

  • @pain5772
    @pain5772 Рік тому

    Sir my output is showing error that e is not defined and useRef is not defined why is that

    • @FesiBaya
      @FesiBaya Рік тому

      useRef should be inside: const TicTacToe = () => { let titleRef = useRef(null);
      }
      and in
      return ( Tic Tac toe Game In React )

  • @manideepmaturi4682
    @manideepmaturi4682 2 місяці тому

    Connecting and retrieving the data from mongo db for these pages

  • @atulmourya7130
    @atulmourya7130 9 місяців тому +1

    bugs alert!
    if you try to click again the box which is already clicked you will get an error and the count of value is increament as well.
    use bellow fixed toggle method to escape the issue!
    const toggle =(e,num)=>
    {
    if(lock){
    return 0;
    }
    if (count%2 === 0){
    e.target.innerHTML = ``;
    if(data[num] === "" ){
    data[num] = "x";
    setCount(++count);
    }
    }
    else{
    e.target.innerHTML = ``;
    if(data[num] === "" ){
    data[num] = "o";
    setCount(++count);
    }
    }
    checkwin();
    }

  • @Spinrider1817
    @Spinrider1817 11 місяців тому +1

    Reset the counter on reset

  • @omsatishthanage6083
    @omsatishthanage6083 10 місяців тому

    how to add draw condition?

  • @kondisettysaidheeraj4276
    @kondisettysaidheeraj4276 7 місяців тому

    bro you are missing the condition that if the game draws .

  • @rachappajiachar5062
    @rachappajiachar5062 Рік тому

    how to create mulitple product details page in single html page using JavaScript please reply sir

  • @sonalkhapre5716
    @sonalkhapre5716 Рік тому

    How to add draw msg, if there is draw?

    • @rashmithagudipudi5979
      @rashmithagudipudi5979 Рік тому

      create variable like is draw
      let isDraw=false;
      then modify cheeckwin with include the draw condition
      else if (!data.includes("")) {
      .
      isDraw = true;
      setLock(true);
      titleRef.current.innerHTML = 'It\'s a Draw!';
      }

  • @titikshyachanda8623
    @titikshyachanda8623 Рік тому

    Why does my toggle function not working?

    • @govindsharma973
      @govindsharma973 10 місяців тому

      Listen tumne data array ko sayad tictac toe ka component ke upar declarr karo chal jayega

  • @eugeneokaka
    @eugeneokaka Рік тому

    more react content

  • @ashumishra2330
    @ashumishra2330 6 місяців тому

    What if we do designing this from Tailwind CSS
    Ans:
    It will become FAST AND FURIOUS😅

  • @opivcm4566
    @opivcm4566 Рік тому

    guys i am getting error in @4:44

  • @wiccanmarvelous
    @wiccanmarvelous Рік тому +1

    pls provide your Git hub link

  • @aztra_01
    @aztra_01 Рік тому

    What if the game gets a Draw?

    • @User123_00__
      @User123_00__ Рік тому

      Good question

    • @Hashek
      @Hashek 10 місяців тому

      then just reset lmao

  • @KondisettySaidheeraj
    @KondisettySaidheeraj 7 місяців тому

    Please provide git link

  • @KondisettySaidheeraj
    @KondisettySaidheeraj 7 місяців тому

    Bro can you send code please.

  • @fast_develop
    @fast_develop Рік тому

    Lol, react documentation game

  • @Examplist
    @Examplist Рік тому

    bad pronounciation, couldnt understand words 9:24

    • @AlejandroMéndez-j6j
      @AlejandroMéndez-j6j 9 місяців тому

      Oh, poor of you, 1 work stoped you.
      Go an learn some English so 1 word doesn't stop you next time. No problem for me.

  • @soumyajeetbiswal8401
    @soumyajeetbiswal8401 4 місяці тому

    3:50 I'm not getting that automatically 😅 it's not importing...need help

  • @smartandrew2362
    @smartandrew2362 3 місяці тому

    const reset = ()=>{
    setLock(false);
    // let data = ["","","","","","","","",""];
    data.fill("");
    titleRef.current.innerHTML = 'Tic Tack Toe Game In React'
    boxArray.map((e) =>{
    e.current.innerHTML = "";
    })
    setCount(0);
    } this help to solve me the bug which is when i resets the game and make one move instanly it satys wins