How can I render different component using onClick() function in React?

I am new to React and creating a Tic-Tac-Toe game. I want to create a starting page with three options :

  1. Start
  2. Rules
  3. Exit

On clicking the start button I want to render the component which consists of the original game. On clicking rules I want to render a page showing rules. I have created seperate components for the three buttons and also the game itself.

Screenshot-Start Page

Screenshot-Main Game

My Tic-Tac-Toe Repo

Source: JavaSript – Stack Overflow

November 5, 2021
Category : News
Tags: buttonclick | conditional-rendering | javascript | onclick | reactjs

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.