This file contains 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
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} |
This file contains 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
(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)}))) | |