This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Reusable component. Expects some side effect to go and put data in the right place, | |
;; so it's accessible by the sub ::chart/chart-js. | |
;; | |
;; Side effect to retrieve data will be triggered by code outside of this component. | |
;; | |
;; Cons: | |
;; - Containing code needs to know where in client db to put data for component to find it. | |
;; | |
;; Pros: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Square(props) { | |
return ( | |
<button className="square" onClick={() => props.onClick()}> | |
{props.value} | |
</button> | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns tic.tac.toe | |
(:require [reagent.core :as r])) | |
(enable-console-print!) | |
(defn vanilla-state [] | |
(r/atom {:squares (vec (repeat 9 nil)) | |
:x-is-next true | |
:winner nil})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Square(props) { | |
return ( | |
<button className="square" onClick={() => props.onClick()}> | |
{props.value} | |
</button> | |
); | |
} | |
class Board extends React.Component { | |
constructor() { |