Skip to content

Instantly share code, notes, and snippets.

View asolove's full-sized avatar
🤔
Thinking about the essence of UI programming

Adam Solove asolove

🤔
Thinking about the essence of UI programming
View GitHub Profile
@benmvp
benmvp / hoc.js
Last active August 29, 2017 06:20
Need Dynamic HOC Flow help
const myHOC = <Props: {}>(
Component: React.ComponentType<{}>
): React.ComponentType<Props> (
(props: Props) = {
let handlers = genDynamicAdditionalProps(props.eventName)
// The keys in `additionalProps` are dependent upon `props.eventName` value
// The values in `additionalProps` are all functions
let propsToPassThru = {...props}
@asolove
asolove / cursor.cljs
Created January 6, 2014 21:43
Om polymorphic cursor
(def map-state { :layers [{:selected true :title "Layer One"}, {:selected false :title "Layer Two" }]})
; I want a way to write reusable components that take and update data from a cursor,
; where the parent decides how the data is calculated and updated.
(defn checkbox [checked]
(om/component
(dom/input {:type "checkbox" :checked checked
:onClick #(om/update! checked (not checked)})))