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

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ธ.ค. 2024

ความคิดเห็น • 88

  • @n0social
    @n0social 9 หลายเดือนก่อน +8

    FINALLY MY FIRST REACT PROJECT THAT WORKS!

  • @orlandoferazzani3639
    @orlandoferazzani3639 9 หลายเดือนก่อน +8

    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 ❤

  • @warriorgaming4866
    @warriorgaming4866 5 หลายเดือนก่อน +1

    🎯 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

  • @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🙏

  • @easycodingwithbg4731
    @easycodingwithbg4731 2 หลายเดือนก่อน

    Very Informative Sir 😘

  • @Zetsu1307
    @Zetsu1307 10 หลายเดือนก่อน +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 3 หลายเดือนก่อน

      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

  • @franciskp9117
    @franciskp9117 8 หลายเดือนก่อน +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.

  • @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.

  • @palanimathi4493
    @palanimathi4493 ปีที่แล้ว

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

  • @AlejandroMéndez-j6j
    @AlejandroMéndez-j6j 8 หลายเดือนก่อน +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.

  • @NikhilPawar151
    @NikhilPawar151 ปีที่แล้ว

    Thank you for such valuable content.

  • @yashlad9412
    @yashlad9412 ปีที่แล้ว

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

  • @ArshaqAk
    @ArshaqAk ปีที่แล้ว +12

    It is not working properly

    • @govindsharma973
      @govindsharma973 9 หลายเดือนก่อน

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

  • @joshuasappor5435
    @joshuasappor5435 11 หลายเดือนก่อน +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

  • @TheEnd-m5w
    @TheEnd-m5w หลายเดือนก่อน +2

    Thankyou sir

    • @GreatStackDev
      @GreatStackDev  หลายเดือนก่อน

      You're welcome. 😊 Keep coding.

    • @TheEnd-m5w
      @TheEnd-m5w หลายเดือนก่อน

      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 TH-cam sir❤

  • @pruthivirajrao2976
    @pruthivirajrao2976 5 หลายเดือนก่อน

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

  • @tebiksingh
    @tebiksingh ปีที่แล้ว

    Love and guidance ❤

  • @dymphna_creates
    @dymphna_creates ปีที่แล้ว +1

    Nice tutorial 😊

  • @soumyajeetbiswal8401
    @soumyajeetbiswal8401 2 หลายเดือนก่อน

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

  • @tarun7453
    @tarun7453 ปีที่แล้ว +1

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

  • @feekz8590
    @feekz8590 6 หลายเดือนก่อน +1

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

  • @FullSTACKDev16
    @FullSTACKDev16 ปีที่แล้ว

    cool game making bro

  • @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.

  • @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 11 หลายเดือนก่อน +2

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

  • @mdsabbirhossen884
    @mdsabbirhossen884 ปีที่แล้ว

    Do you need channel seo manager?

  • @mahkamov_9
    @mahkamov_9 2 หลายเดือนก่อน

    Thank You

  • @SandeepMR26
    @SandeepMR26 ปีที่แล้ว

    Awesome keep it up .
    .

  • @A11-b6e4s
    @A11-b6e4s ปีที่แล้ว +2

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

  • @heyyangshuman
    @heyyangshuman 11 หลายเดือนก่อน

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

    • @User123_00__
      @User123_00__ 11 หลายเดือนก่อน

      First you need to install node js on your system

    • @pratishrutisahoo7
      @pratishrutisahoo7 10 หลายเดือนก่อน

      npm create vite@latest

  • @aswinkrishna9783
    @aswinkrishna9783 10 หลายเดือนก่อน +2

    why images are not showing when i import

    • @AhmadHassan-o6f
      @AhmadHassan-o6f 3 หลายเดือนก่อน

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

  • @prakashchalke1708
    @prakashchalke1708 ปีที่แล้ว

    Wonderful, friend.

  • @dancepractice805
    @dancepractice805 ปีที่แล้ว +1

    It was very useful

  • @dipankarpaul3405
    @dipankarpaul3405 ปีที่แล้ว

    Please make some videos with Svelte or SvelteKit...

  • @atulmourya7130
    @atulmourya7130 8 หลายเดือนก่อน +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();
    }

  • @aymenbachiri-yh2hd
    @aymenbachiri-yh2hd ปีที่แล้ว

    thank you

  • @vishuchahar7320
    @vishuchahar7320 2 หลายเดือนก่อน

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

    • @VedantKumbharkar-f2x
      @VedantKumbharkar-f2x 25 วันที่ผ่านมา

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

  • @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.

  • @manideepmaturi4682
    @manideepmaturi4682 หลายเดือนก่อน

    Connecting and retrieving the data from mongo db for these pages

  • @opivcm4566
    @opivcm4566 ปีที่แล้ว

    guys i am getting error in @4:44

  • @devrimsarikaya
    @devrimsarikaya 10 หลายเดือนก่อน

    çok teşekkürler :)

  • @rachappajiachar5062
    @rachappajiachar5062 ปีที่แล้ว

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

  • @clouduro5227
    @clouduro5227 5 หลายเดือนก่อน

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

  • @arunkumar-pr1rg
    @arunkumar-pr1rg 8 หลายเดือนก่อน

    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

  • @MaulanaRafinda-r8l
    @MaulanaRafinda-r8l ปีที่แล้ว

    Thanks...

  • @ibrohimismoilov8345
    @ibrohimismoilov8345 11 หลายเดือนก่อน

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

  • @Spinrider1817
    @Spinrider1817 9 หลายเดือนก่อน +1

    Reset the counter on reset

  • @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 )

  • @eugeneokaka
    @eugeneokaka ปีที่แล้ว

    more react content

  • @Nanashi-rq7lk
    @Nanashi-rq7lk ปีที่แล้ว +1

    Nice

  • @omsatishthanage6083
    @omsatishthanage6083 9 หลายเดือนก่อน

    how to add draw condition?

  • @titikshyachanda8623
    @titikshyachanda8623 10 หลายเดือนก่อน

    Why does my toggle function not working?

    • @govindsharma973
      @govindsharma973 9 หลายเดือนก่อน

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

  • @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!';
      }

  • @wiccanmarvelous
    @wiccanmarvelous ปีที่แล้ว +1

    pls provide your Git hub link

  • @ashumishra2330
    @ashumishra2330 4 หลายเดือนก่อน

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

  • @kondisettysaidheeraj4276
    @kondisettysaidheeraj4276 6 หลายเดือนก่อน

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

  • @KondisettySaidheeraj
    @KondisettySaidheeraj 6 หลายเดือนก่อน

    Please provide git link

  • @loser8198
    @loser8198 ปีที่แล้ว

    Awesome

  • @KondisettySaidheeraj
    @KondisettySaidheeraj 6 หลายเดือนก่อน

    Bro can you send code please.

  • @aztra_01
    @aztra_01 ปีที่แล้ว

    What if the game gets a Draw?

    • @User123_00__
      @User123_00__ 11 หลายเดือนก่อน

      Good question

    • @Hashek
      @Hashek 9 หลายเดือนก่อน

      then just reset lmao

  • @fast_develop
    @fast_develop ปีที่แล้ว

    Lol, react documentation game

  • @Examplist
    @Examplist 11 หลายเดือนก่อน

    bad pronounciation, couldnt understand words 9:24

    • @AlejandroMéndez-j6j
      @AlejandroMéndez-j6j 8 หลายเดือนก่อน

      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.

  • @smartandrew2362
    @smartandrew2362 หลายเดือนก่อน

    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