{"id":3461,"date":"2022-09-21T19:51:43","date_gmt":"2022-09-21T14:51:43","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=3461"},"modified":"2022-09-21T19:51:46","modified_gmt":"2022-09-21T14:51:46","slug":"build-tic-tac-toe-strategy-board-game-in-react-js","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/","title":{"rendered":"Build Tic-Tac-Toe Strategy Board Game in React.js"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"308\" height=\"401\" src=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/react_js_tic_tac_toe.jpg\" alt=\"Tic-Tac-Toe Strategy Board Game in React.js\" class=\"wp-image-3462\" title=\"Tic-Tac-Toe Strategy Board Game in React.js\" srcset=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/react_js_tic_tac_toe.jpg 308w, https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/react_js_tic_tac_toe-230x300.jpg 230w\" sizes=\"auto, (max-width: 308px) 100vw, 308px\" \/><figcaption>Tic-Tac-Toe Strategy Board Game in React.js<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">App.js<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">import React, { Component } from 'react'\nimport {initializeApp} from 'firebase\/app'\nimport {getAuth,signInWithPopup,FacebookAuthProvider} from 'firebase\/auth'\nconst firebaseConfig = {\n  apiKey: &quot;AIzaSyCq_NoSPfOmBMzg95-xAtJDGdeu786RjeU&quot;,\n  authDomain: &quot;gasbooking-780bc.firebaseapp.com&quot;,\n  databaseURL: &quot;https:\/\/gasbooking-780bc.firebaseio.com&quot;,\n  projectId: &quot;gasbooking-780bc&quot;,\n  storageBucket: &quot;gasbooking-780bc.appspot.com&quot;,\n  messagingSenderId: &quot;330414310435&quot;,\n  appId: &quot;1:330414310435:web:cbe8e168419e9cb2cf5d96&quot;\n};\n\nconst app = initializeApp(firebaseConfig)\nclass App extends Component {\n  state = {\n    user: null\n  }\n  login = () =&gt; {\n    const provider = new FacebookAuthProvider();\n\n    const auth = getAuth(app);\n    signInWithPopup(provider)\n      .then((result) =&gt; {\n        \/\/ The signed-in user info.\n        const user = result.user;\n        console.log(user)\n    \n        \/\/ This gives you a Facebook Access Token. You can use it to access the Facebook API.\n        const credential = FacebookAuthProvider.credentialFromResult(result);\n        const accessToken = credential.accessToken;\n        console.log(accessToken)\n    \n        \/\/ ...\n      })\n      .catch((error) =&gt; {\n        \/\/ Handle Errors here.\n        const errorCode = error.code;\n        const errorMessage = error.message;\n        \/\/ The email of the user's account used.\n        const email = error.customData.email;\n        \/\/ The AuthCredential type that was used.\n        const credential = FacebookAuthProvider.credentialFromError(error);\n    \n        \/\/ ...\n      });\n  }\n  logout = () =&gt; {\n    getAuth().signOut().then(() =&gt; {\n      this.setState({ user: null })\n    })\n  }\n  render() {\n    const { user } = this.state\n    return (\n      &lt;div className='App'&gt;\n        &lt;p&gt;{user ? `Hi, ${user.displayName}!` : 'Hi!'}&lt;\/p&gt;\n        &lt;button onClick={this.login}&gt;\n          Login with Facebook\n        &lt;\/button&gt;\n        &lt;button onClick={this.logout}&gt;\n          Logout\n        &lt;\/button&gt;\n      &lt;\/div&gt;\n    );\n  }\n}\n\nexport default App<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">index.css<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;css&quot;,&quot;mime&quot;:&quot;text\/css&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;CSS&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;css&quot;}\">body {\n  font: 14px &quot;Century Gothic&quot;, Futura, sans-serif;\n  margin: 20px;\n}\n\nol,\nul {\n  padding-left: 30px;\n}\n\n.board-row:after {\n  clear: both;\n  content: &quot;&quot;;\n  display: table;\n}\n\n.status {\n  margin-bottom: 10px;\n}\n\n.square {\n  background: #fff;\n  border: 1px solid #999;\n  float: left;\n  font-size: 24px;\n  font-weight: bold;\n  line-height: 34px;\n  height: 34px;\n  margin-right: -1px;\n  margin-top: -1px;\n  padding: 0;\n  text-align: center;\n  width: 34px;\n}\n\n.square:focus {\n  outline: none;\n}\n\n.kbd-navigation .square:focus {\n  background: #ddd;\n}\n\n.game {\n  display: flex;\n  flex-direction: row;\n}\n\n.game-info {\n  margin-left: 20px;\n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>App.js index.css<\/p>\n","protected":false},"author":1,"featured_media":1762,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-3461","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Build Tic-Tac-Toe Strategy Board Game in React.js<\/title>\n<meta name=\"description\" content=\"Tic-Tac-Toe Strategy Board Game in React.js App.js import React, { Component } from &#039;react&#039; import {initializeApp} from &#039;firebase\/app&#039; import\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build Tic-Tac-Toe Strategy Board Game in React.js\" \/>\n<meta property=\"og:description\" content=\"Tic-Tac-Toe Strategy Board Game in React.js App.js import React, { Component } from &#039;react&#039; import {initializeApp} from &#039;firebase\/app&#039; import\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-21T14:51:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-21T14:51:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/react_js_tic_tac_toe.jpg\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Build Tic-Tac-Toe Strategy Board Game in React.js","description":"Tic-Tac-Toe Strategy Board Game in React.js App.js import React, { Component } from 'react' import {initializeApp} from 'firebase\/app' import","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/","og_locale":"en_US","og_type":"article","og_title":"Build Tic-Tac-Toe Strategy Board Game in React.js","og_description":"Tic-Tac-Toe Strategy Board Game in React.js App.js import React, { Component } from 'react' import {initializeApp} from 'firebase\/app' import","og_url":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2022-09-21T14:51:43+00:00","article_modified_time":"2022-09-21T14:51:46+00:00","og_image":[{"url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/09\/react_js_tic_tac_toe.jpg","type":"","width":"","height":""}],"author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"Build Tic-Tac-Toe Strategy Board Game in React.js","datePublished":"2022-09-21T14:51:43+00:00","dateModified":"2022-09-21T14:51:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/"},"wordCount":19,"commentCount":0,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/","url":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/","name":"Build Tic-Tac-Toe Strategy Board Game in React.js","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","datePublished":"2022-09-21T14:51:43+00:00","dateModified":"2022-09-21T14:51:46+00:00","description":"Tic-Tac-Toe Strategy Board Game in React.js App.js import React, { Component } from 'react' import {initializeApp} from 'firebase\/app' import","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","width":880,"height":495,"caption":"Default Featured Image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/build-tic-tac-toe-strategy-board-game-in-react-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Build Tic-Tac-Toe Strategy Board Game in React.js"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=3461"}],"version-history":[{"count":1,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3461\/revisions"}],"predecessor-version":[{"id":3463,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3461\/revisions\/3463"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/1762"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=3461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=3461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=3461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}