Skip to content

Instantly share code, notes, and snippets.

View ingesolvoll's full-sized avatar

Inge Solvoll ingesolvoll

View GitHub Profile
;; 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:
function Square(props) {
return (
<button className="square" onClick={() => props.onClick()}>
{props.value}
</button>
);
}
(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}))
@ingesolvoll
ingesolvoll / tictactoe.js
Last active January 9, 2017 23:35
The React Tic tac toe tutorial
function Square(props) {
return (
<button className="square" onClick={() => props.onClick()}>
{props.value}
</button>
);
}
class Board extends React.Component {
constructor() {